<?php
/*********************/
/*                   */
/*  Dezend for PHP5  */
/*         NWS       */
/*      Nulled.WS    */
/*                   */
/*********************/

include( "gConfig.php" );
$uid = $_GET['uid'];
if ( $uid == "" )
{
    exit( );
}
$Lang = $_GET['Lang'];
if ( $Lang != "big5" && $Lang != "iso-8859-2" )
{
    $Lang = "utf-8";
}
$type = $_GET['type'];
if ( $type < 1 || 5 < $type )
{
    exit( );
}
$k_f = $_POST['k_f'];
if ( $k_f == "" )
{
    $k_f = $_GET['k_f'];
}
$k_ud = $_POST['k_ud'];
if ( is_float( $k_ud ) )
{
    echoerror( "NOT FLOAT!" );
}
$page = $_POST['page'];
if ( $page < 0 )
{
    $page = 0;
}
$enable = $_POST['enable'];
if ( $enable == "" )
{
    $enable = $_GET['enable'];
}
if ( $k_f != "" && $enable == "" )
{
    $enable = "A";
}
if ( $enable != "N" && $enable != "A" )
{
    $enable = "Y";
}
$sort = $_POST['sort'];
if ( $sort == "" )
{
    $sort = $_GET['sort'];
}
if ( $sort == "" )
{
    $sort = 2;
}
$order = $_POST['order'];
if ( $order == "" )
{
    $order = $_GET['order'];
}
if ( $order < 0 )
{
    $order = 0;
}
$boss = $_POST['boss'];
if ( $boss == "" )
{
    $boss = $_GET['boss'];
}
$k_mode = $_POST['k_mode'];
$k_name = $_POST['k_name'];
$k_copy = $_POST['k_copy'];
$k_cname = $_POST['k_cname'];
$k_data = $_POST['k_data0']."@".$_POST['k_data1']."@".$_POST['k_data2']."@".$_POST['k_data3']."@".$_POST['k_data4']."@".$_POST['k_data5'];
$k_passwd = $_POST['k_passwd'];
$k_credit = $_POST['k_credit'];
if ( $k_credit < 0 )
{
    $k_credit = 0;
}
$k_order = $_POST['k_order'];
$k_unit = $_POST['k_unit'];
$k_ck01 = $_POST['k_ck01'];
$k_ck8192 = $_POST['k_ck8192'];
$k_betwin1 = $_POST['k_betwin1'];
$k_betwin2 = $_POST['k_betwin2'];
$k_betwin3 = $_POST['k_betwin3'];
$k_rang = $_POST['k_rang'];
if ( $k_rang < 0 - 1 || 100 < $k_rang )
{
    $k_rang = 0;
}
$k_rang1 = $_POST['k_rang1'];
if ( $k_rang1 < 0 - 1 || 100 < $k_rang1 )
{
    $k_rang1 = 0;
}
$k_water = $_POST['k_water'];
if ( $k_water < 0 || 2 < $k_water )
{
    $k_water = 0;
    echoerror( "退水设定".$k_water."必在0~2" );
}
$k_minbet = $_POST['k_minbet'];
if ( $k_minbet < 1 )
{
    $k_minbet = 10;
}
$k_maxbet1 = $_POST['k_maxbet1'];
if ( $k_maxbet1 <= 0 )
{
    $k_maxbet1 = "5000";
}
$k_maxbet2 = $_POST['k_maxbet2'];
if ( $k_maxbet2 <= 0 )
{
    $k_maxbet2 = "5000";
}
$k_maxbet3 = $_POST['k_maxbet3'];
if ( $k_maxbet3 <= 0 )
{
    $k_maxbet3 = "5000";
}
$k_maxbet4 = $_POST['k_maxbet4'];
if ( $k_maxbet4 <= 0 )
{
    $k_maxbet4 = "5000";
}
$k_limit1 = $_POST['k_limit1'];
if ( $k_limit1 <= 0 )
{
    $k_limit1 = "-1";
}
$k_limit2 = $_POST['k_limit2'];
if ( $k_limit2 <= 0 )
{
    $k_limit2 = "-1";
}
$k_limit3 = $_POST['k_limit3'];
if ( $k_limit3 <= 0 )
{
    $k_limit3 = "-1";
}
$k_limit4 = $_POST['k_limit4'];
if ( $k_limit4 <= 0 )
{
    $k_limit4 = "-1";
}
$k_betmode = $_POST['k_betmode'];
if ( $k_betmode <= 0 )
{
    $k_betmode = "0";
}
$k_mag1 = $_POST['k_mag1'];
if ( $k_mag1 <= 0 )
{
    $k_mag1 = "-1";
}
$k_mag2 = $_POST['k_mag2'];
if ( $k_mag2 <= 0 )
{
    $k_mag2 = "-1";
}
$k_mag3 = $_POST['k_mag3'];
if ( $k_mag3 <= 0 )
{
    $k_mag3 = "-1";
}
$k_mag4 = $_POST['k_mag4'];
if ( $k_mag4 <= 0 )
{
    $k_mag4 = "-1";
}
$k_ck01 = $_POST['k_ck01'];
$k_ck02 = $_POST['k_ck02'];
$k_ck03 = $_POST['k_ck03'];
$k_nobet1 = $_POST['k_nobet1'];
$k_nobet2 = $_POST['k_nobet2'];
$k_nobet3 = $_POST['k_nobet3'];
$k_nobet4 = $_POST['k_nobet4'];
$k_nobet5 = $_POST['k_nobet5'];
$k3_water = $_POST['k3_water'];
if ( $k3_water < 0 || 2 < $k3_water )
{
    $k3_water = 0;
}
$k3_water += 0;
$k3_minbet = $_POST['k3_minbet'];
if ( $k3_minbet < 1 )
{
    $k3_minbet = 10;
}
$k3_maxbet1 = $_POST['k3_maxbet1'];
if ( $k3_maxbet1 <= 0 )
{
    $k3_maxbet1 = "5000";
}
$k3_maxbet2 = $_POST['k3_maxbet2'];
if ( $k3_maxbet2 <= 0 )
{
    $k3_maxbet2 = "5000";
}
$k3_maxbet3 = $_POST['k3_maxbet3'];
if ( $k3_maxbet3 <= 0 )
{
    $k3_maxbet3 = "5000";
}
$k3_limit1 = $_POST['k3_limit1'];
if ( $k3_limit1 <= 0 )
{
    $k3_limit1 = "-1";
}
$k3_limit2 = $_POST['k3_limit2'];
if ( $k3_limit2 <= 0 )
{
    $k3_limit2 = "-1";
}
$k3_limit3 = $_POST['k3_limit3'];
if ( $k3_limit3 <= 0 )
{
    $k3_limit3 = "-1";
}
$k3_ck01 = $_POST['k3_ck01'];
$k3_ck02 = $_POST['k3_ck02'];
$k3_ck03 = $_POST['k3_ck03'];
$k5_water = $_POST['k5_water'];
if ( $k5_water < 0 || 2 < $k5_water )
{
    $k5_water = 0;
}
$k5_water += 0;
$k5_minbet = $_POST['k5_minbet'];
if ( $k5_minbet < 1 )
{
    $k5_minbet = 10;
}
$k5_maxbet1 = $_POST['k5_maxbet1'];
if ( $k5_maxbet1 <= 0 )
{
    $k5_maxbet1 = "5000";
}
$k5_maxbet2 = $_POST['k5_maxbet2'];
if ( $k5_maxbet2 <= 0 )
{
    $k5_maxbet2 = "5000";
}
$k5_maxbet3 = $_POST['k5_maxbet3'];
if ( $k5_maxbet3 <= 0 )
{
    $k5_maxbet3 = "5000";
}
$k5_maxbet4 = $_POST['k5_maxbet4'];
if ( $k5_maxbet4 <= 0 )
{
    $k5_maxbet4 = "5000";
}
$k5_maxbet5 = $_POST['k5_maxbet5'];
if ( $k5_maxbet5 <= 0 )
{
    $k5_maxbet5 = "5000";
}
$k5_maxbet6 = $_POST['k5_maxbet6'];
if ( $k5_maxbet6 <= 0 )
{
    $k5_maxbet6 = "5000";
}
$k5_maxbet7 = $_POST['k5_maxbet7'];
if ( $k5_maxbet7 <= 0 )
{
    $k5_maxbet7 = "5000";
}
$k5_limit1 = $_POST['k5_limit1'];
if ( $k5_limit1 <= 0 )
{
    $k5_limit1 = "-1";
}
$k5_limit2 = $_POST['k5_limit2'];
if ( $k5_limit2 <= 0 )
{
    $k5_limit2 = "-1";
}
$k5_limit3 = $_POST['k5_limit3'];
if ( $k5_limit3 <= 0 )
{
    $k5_limit3 = "-1";
}
$k5_limit4 = $_POST['k5_limit4'];
if ( $k5_limit4 <= 0 )
{
    $k5_limit4 = "-1";
}
$k5_limit5 = $_POST['k5_limit5'];
if ( $k5_limit5 <= 0 )
{
    $k5_limit5 = "-1";
}
$k5_limit6 = $_POST['k5_limit6'];
if ( $k5_limit6 <= 0 )
{
    $k5_limit6 = "-1";
}
$k5_limit7 = $_POST['k5_limit7'];
if ( $k5_limit7 <= 0 )
{
    $k5_limit7 = "-1";
}
$k5_mag1 = $_POST['k5_mag1'];
if ( $k5_mag1 <= 0 )
{
    $k5_mag1 = "-1";
}
$k5_mag2 = $_POST['k5_mag2'];
if ( $k5_mag2 <= 0 )
{
    $k5_mag2 = "-1";
}
$k5_mag3 = $_POST['k5_mag3'];
if ( $k5_mag3 <= 0 )
{
    $k5_mag3 = "-1";
}
$k5_mag4 = $_POST['k5_mag4'];
if ( $k5_mag4 <= 0 )
{
    $k5_mag4 = "-1";
}
$k5_mag5 = $_POST['k5_mag5'];
if ( $k5_mag5 <= 0 )
{
    $k5_mag5 = "-1";
}
$k5_mag6 = $_POST['k5_mag6'];
if ( $k5_mag6 <= 0 )
{
    $k5_mag6 = "-1";
}
$k5_mag7 = $_POST['k5_mag7'];
if ( $k5_mag7 <= 0 )
{
    $k5_mag7 = "-1";
}
$k5_betmode = $_POST['k5_betmode'];
if ( $k5_betmode <= 0 )
{
    $k5_betmode = "0";
}
$k6_water = $_POST['k6_water'];
if ( $k6_water < 0 || 2 < $k6_water )
{
    $k6_water = 0;
}
$k6_water += 0;
$k6_minbet = $_POST['k6_minbet'];
if ( $k6_minbet < 1 )
{
    $k6_minbet = 10;
}
$k6_maxbet1 = $_POST['k6_maxbet1'];
if ( $k6_maxbet1 <= 0 )
{
    $k6_maxbet1 = "5000";
}
$k6_maxbet2 = $_POST['k6_maxbet2'];
if ( $k6_maxbet2 <= 0 )
{
    $k6_maxbet2 = "5000";
}
$k6_maxbet3 = $_POST['k6_maxbet3'];
if ( $k6_maxbet3 <= 0 )
{
    $k6_maxbet3 = "5000";
}
$k6_limit1 = $_POST['k6_limit1'];
if ( $k6_limit1 <= 0 )
{
    $k6_limit1 = "-1";
}
$k6_limit2 = $_POST['k6_limit2'];
if ( $k6_limit2 <= 0 )
{
    $k6_limit2 = "-1";
}
$k6_limit3 = $_POST['k6_limit3'];
if ( $k6_limit3 <= 0 )
{
    $k6_limit3 = "-1";
}
$k6_mag1 = $_POST['k6_mag1'];
if ( $k6_mag1 <= 0 )
{
    $k6_mag1 = "-1";
}
$k6_mag2 = $_POST['k6_mag2'];
if ( $k6_mag2 <= 0 )
{
    $k6_mag2 = "-1";
}
$k6_mag3 = $_POST['k6_mag3'];
if ( $k6_mag3 <= 0 )
{
    $k6_mag3 = "-1";
}
$k6_betmode = $_POST['k6_betmode'];
if ( $k6_betmode <= 0 )
{
    $k6_betmode = "0";
}
$k6_betwin = $_POST['k6_betwin'];
$k6_nobet1 = $_POST['k6_nobet1'];
$k6_nobet2 = $_POST['k6_nobet2'];
$k7_water = $_POST['k7_water'];
if ( $k7_water < 0 || 2 < $k7_water )
{
    $k7_water = 0;
}
$k7_water += 0;
$k7_minbet = $_POST['k7_minbet'];
if ( $k7_minbet < 1 )
{
    $k7_minbet = 10;
}
$k7_maxbet1 = $_POST['k7_maxbet1'];
if ( $k7_maxbet1 <= 0 )
{
    $k7_maxbet1 = "5000";
}
$k7_maxbet2 = $_POST['k7_maxbet2'];
if ( $k7_maxbet2 <= 0 )
{
    $k7_maxbet2 = "5000";
}
$k7_maxbet3 = $_POST['k7_maxbet3'];
if ( $k7_maxbet3 <= 0 )
{
    $k7_maxbet3 = "5000";
}
$k7_maxbet4 = $_POST['k7_maxbet4'];
if ( $k7_maxbet4 <= 0 )
{
    $k7_maxbet4 = "5000";
}
$k7_maxbet5 = $_POST['k7_maxbet5'];
if ( $k7_maxbet5 <= 0 )
{
    $k7_maxbet5 = "5000";
}
$k7_maxbet6 = $_POST['k7_maxbet6'];
if ( $k7_maxbet6 <= 0 )
{
    $k7_maxbet6 = "5000";
}
$k7_limit1 = $_POST['k7_limit1'];
if ( $k7_limit1 <= 0 )
{
    $k7_limit1 = "-1";
}
$k7_limit2 = $_POST['k7_limit2'];
if ( $k7_limit2 <= 0 )
{
    $k7_limit2 = "-1";
}
$k7_limit3 = $_POST['k7_limit3'];
if ( $k7_limit3 <= 0 )
{
    $k7_limit3 = "-1";
}
$k7_limit4 = $_POST['k7_limit4'];
if ( $k7_limit4 <= 0 )
{
    $k7_limit4 = "-1";
}
$k7_limit5 = $_POST['k7_limit5'];
if ( $k7_limit5 <= 0 )
{
    $k7_limit5 = "-1";
}
$k7_limit6 = $_POST['k7_limit6'];
if ( $k7_limit6 <= 0 )
{
    $k7_limit6 = "-1";
}
$k7_mag1 = $_POST['k7_mag1'];
if ( $k7_mag1 <= 0 )
{
    $k7_mag1 = "-1";
}
$k7_mag2 = $_POST['k7_mag2'];
if ( $k7_mag2 <= 0 )
{
    $k7_mag2 = "-1";
}
$k7_mag3 = $_POST['k7_mag3'];
if ( $k7_mag3 <= 0 )
{
    $k7_mag3 = "-1";
}
$k7_mag4 = $_POST['k7_mag4'];
if ( $k7_mag4 <= 0 )
{
    $k7_mag4 = "-1";
}
$k7_mag5 = $_POST['k7_mag5'];
if ( $k7_mag5 <= 0 )
{
    $k7_mag5 = "-1";
}
$k7_mag6 = $_POST['k7_mag6'];
if ( $k7_mag6 <= 0 )
{
    $k7_mag6 = "-1";
}
$k7_betmode = $_POST['k7_betmode'];
if ( $k7_betmode <= 0 )
{
    $k7_betmode = "0";
}
$k7_betwin = $_POST['k7_betwin'];
$k7_nobet1 = $_POST['k7_nobet1'];
$k7_nobet2 = $_POST['k7_nobet2'];
$k8_water = $_POST['k8_water'];
if ( $k8_water < 0 || 2 < $k8_water )
{
    $k8_water = 0;
}
$k8_water += 0;
$k8_minbet = $_POST['k8_minbet'];
if ( $k8_minbet < 1 )
{
    $k8_minbet = 10;
}
$k8_maxbet1 = $_POST['k8_maxbet1'];
if ( $k8_maxbet1 <= 0 )
{
    $k8_maxbet1 = "5000";
}
$k8_maxbet2 = $_POST['k8_maxbet2'];
if ( $k8_maxbet2 <= 0 )
{
    $k8_maxbet2 = "5000";
}
$k8_maxbet3 = $_POST['k8_maxbet3'];
if ( $k8_maxbet3 <= 0 )
{
    $k8_maxbet3 = "5000";
}
$k8_maxbet4 = $_POST['k8_maxbet4'];
if ( $k8_maxbet4 <= 0 )
{
    $k8_maxbet4 = "5000";
}
$k8_maxbet5 = $_POST['k8_maxbet5'];
if ( $k8_maxbet5 <= 0 )
{
    $k8_maxbet5 = "5000";
}
$k8_maxbet6 = $_POST['k8_maxbet6'];
if ( $k8_maxbet6 <= 0 )
{
    $k8_maxbet6 = "5000";
}
$k8_maxbet7 = $_POST['k8_maxbet7'];
if ( $k8_maxbet7 <= 0 )
{
    $k8_maxbet7 = "5000";
}
$k8_limit1 = $_POST['k8_limit1'];
if ( $k8_limit1 <= 0 )
{
    $k8_limit1 = "-1";
}
$k8_limit2 = $_POST['k8_limit2'];
if ( $k8_limit2 <= 0 )
{
    $k8_limit2 = "-1";
}
$k8_limit3 = $_POST['k8_limit3'];
if ( $k8_limit3 <= 0 )
{
    $k8_limit3 = "-1";
}
$k8_limit4 = $_POST['k8_limit4'];
if ( $k8_limit4 <= 0 )
{
    $k8_limit4 = "-1";
}
$k8_limit5 = $_POST['k8_limit5'];
if ( $k8_limit5 <= 0 )
{
    $k8_limit5 = "-1";
}
$k8_limit6 = $_POST['k8_limit6'];
if ( $k8_limit6 <= 0 )
{
    $k8_limit6 = "-1";
}
$k8_limit7 = $_POST['k8_limit7'];
if ( $k8_limit7 <= 0 )
{
    $k8_limit7 = "-1";
}
$k8_mag1 = $_POST['k8_mag1'];
if ( $k8_mag1 <= 0 )
{
    $k8_mag1 = "-1";
}
$k8_mag2 = $_POST['k8_mag2'];
if ( $k8_mag2 <= 0 )
{
    $k8_mag2 = "-1";
}
$k8_mag3 = $_POST['k8_mag3'];
if ( $k8_mag3 <= 0 )
{
    $k8_mag3 = "-1";
}
$k8_mag4 = $_POST['k8_mag4'];
if ( $k8_mag4 <= 0 )
{
    $k8_mag4 = "-1";
}
$k8_mag5 = $_POST['k8_mag5'];
if ( $k8_mag5 <= 0 )
{
    $k8_mag5 = "-1";
}
$k8_mag6 = $_POST['k8_mag6'];
if ( $k8_mag6 <= 0 )
{
    $k8_mag6 = "-1";
}
$k8_mag7 = $_POST['k8_mag7'];
if ( $k8_mag7 <= 0 )
{
    $k8_mag7 = "-1";
}
$k8_betmode = $_POST['k8_betmode'];
if ( $k8_betmode <= 0 )
{
    $k8_betmode = "0";
}
$k8_betwin = $_POST['k8_betwin'];
$k8_nobet1 = $_POST['k8_nobet1'];
$k8_nobet2 = $_POST['k8_nobet2'];
$k9_water = $_POST['k9_water'];
if ( $k9_water < 0 || 2 < $k9_water )
{
    $k9_water = 0;
}
$k9_water += 0;
$k9_minbet = $_POST['k9_minbet'];
if ( $k9_minbet < 1 )
{
    $k9_minbet = 10;
}
$k9_maxbet1 = $_POST['k9_maxbet1'];
if ( $k9_maxbet1 <= 0 )
{
    $k9_maxbet1 = "5000";
}
$k9_maxbet2 = $_POST['k9_maxbet2'];
if ( $k9_maxbet2 <= 0 )
{
    $k9_maxbet2 = "5000";
}
$k9_maxbet3 = $_POST['k9_maxbet3'];
if ( $k9_maxbet3 <= 0 )
{
    $k9_maxbet3 = "5000";
}
$k9_maxbet4 = $_POST['k9_maxbet4'];
if ( $k9_maxbet4 <= 0 )
{
    $k9_maxbet4 = "5000";
}
$k9_limit1 = $_POST['k9_limit1'];
if ( $k9_limit1 <= 0 )
{
    $k9_limit1 = "-1";
}
$k9_limit2 = $_POST['k9_limit2'];
if ( $k9_limit2 <= 0 )
{
    $k9_limit2 = "-1";
}
$k9_limit3 = $_POST['k9_limit3'];
if ( $k9_limit3 <= 0 )
{
    $k9_limit3 = "-1";
}
$k9_limit4 = $_POST['k9_limit4'];
if ( $k9_limit4 <= 0 )
{
    $k9_limit4 = "-1";
}
$k9_mag1 = $_POST['k9_mag1'];
if ( $k9_mag1 <= 0 )
{
    $k9_mag1 = "-1";
}
$k9_mag2 = $_POST['k9_mag2'];
if ( $k9_mag2 <= 0 )
{
    $k9_mag2 = "-1";
}
$k9_mag3 = $_POST['k9_mag3'];
if ( $k9_mag3 <= 0 )
{
    $k9_mag3 = "-1";
}
$k9_mag4 = $_POST['k9_mag4'];
if ( $k9_mag4 <= 0 )
{
    $k9_mag4 = "-1";
}
$k9_betmode = $_POST['k9_betmode'];
if ( $k9_betmode <= 0 )
{
    $k9_betmode = "0";
}
$k9_betwin = $_POST['k9_betwin'];
$k9_nobet1 = $_POST['k9_nobet1'];
$k9_nobet2 = $_POST['k9_nobet2'];
$k10_water = $_POST['k10_water'];
if ( $k10_water < 0 || 2 < $k10_water )
{
    $k10_water = 0;
}
$k10_water += 0;
$k10_minbet = $_POST['k10_minbet'];
if ( $k10_minbet < 1 )
{
    $k10_minbet = 10;
}
$k10_maxbet1 = $_POST['k10_maxbet1'];
if ( $k10_maxbet1 <= 0 )
{
    $k10_maxbet1 = "5000";
}
$k10_maxbet2 = $_POST['k10_maxbet2'];
if ( $k10_maxbet2 <= 0 )
{
    $k10_maxbet2 = "5000";
}
$k10_maxbet3 = $_POST['k10_maxbet3'];
if ( $k10_maxbet3 <= 0 )
{
    $k10_maxbet3 = "5000";
}
$k10_maxbet4 = $_POST['k10_maxbet4'];
if ( $k10_maxbet4 <= 0 )
{
    $k10_maxbet4 = "5000";
}
$k10_limit1 = $_POST['k10_limit1'];
if ( $k10_limit1 <= 0 )
{
    $k10_limit1 = "-1";
}
$k10_limit2 = $_POST['k10_limit2'];
if ( $k10_limit2 <= 0 )
{
    $k10_limit2 = "-1";
}
$k10_limit3 = $_POST['k10_limit3'];
if ( $k10_limit3 <= 0 )
{
    $k10_limit3 = "-1";
}
$k10_limit4 = $_POST['k10_limit4'];
if ( $k10_limit4 <= 0 )
{
    $k10_limit4 = "-1";
}
$k10_mag1 = $_POST['k10_mag1'];
if ( $k10_mag1 <= 0 )
{
    $k10_mag1 = "-1";
}
$k10_mag2 = $_POST['k10_mag2'];
if ( $k10_mag2 <= 0 )
{
    $k10_mag2 = "-1";
}
$k10_mag3 = $_POST['k10_mag3'];
if ( $k10_mag3 <= 0 )
{
    $k10_mag3 = "-1";
}
$k10_mag4 = $_POST['k10_mag4'];
if ( $k10_mag4 <= 0 )
{
    $k10_mag4 = "-1";
}
$k10_betmode = $_POST['k10_betmode'];
if ( $k10_betmode <= 0 )
{
    $k10_betmode = "0";
}
$k10_betwin = $_POST['k10_betwin'];
$k10_nobet1 = $_POST['k10_nobet1'];
$k10_nobet2 = $_POST['k10_nobet2'];
$k11_water = $_POST['k11_water'];
if ( $k11_water < 0 || 2 < $k11_water )
{
    $k11_water = 0;
}
$k11_water += 0;
$k11_minbet = $_POST['k11_minbet'];
if ( $k11_minbet < 1 )
{
    $k11_minbet = 10;
}
$k11_maxbet1 = $_POST['k11_maxbet1'];
if ( $k11_maxbet1 <= 0 )
{
    $k11_maxbet1 = "5000";
}
$k11_limit1 = $_POST['k11_limit1'];
if ( $k11_limit1 <= 0 )
{
    $k11_limit1 = "-1";
}
$k11_mag1 = $_POST['k11_mag1'];
if ( $k11_mag1 <= 0 )
{
    $k11_mag1 = "-1";
}
$k11_betmode = $_POST['k11_betmode'];
if ( $k11_betmode <= 0 )
{
    $k11_betmode = "0";
}
$k11_betwin = $_POST['k11_betwin'];
$k11_nobet1 = $_POST['k11_nobet1'];
$k11_nobet2 = $_POST['k11_nobet2'];
$k12_water = $_POST['k12_water'];
if ( $k12_water < 0 || 2 < $k12_water )
{
    $k12_water = 0;
}
$k12_water += 0;
$k12_minbet = $_POST['k12_minbet'];
if ( $k12_minbet < 1 )
{
    $k12_minbet = 10;
}
$k12_maxbet1 = $_POST['k12_maxbet1'];
if ( $k12_maxbet1 <= 0 )
{
    $k12_maxbet1 = "5000";
}
$k12_limit1 = $_POST['k12_limit1'];
if ( $k12_limit1 <= 0 )
{
    $k12_limit1 = "-1";
}
$k12_mag1 = $_POST['k12_mag1'];
if ( $k12_mag1 <= 0 )
{
    $k12_mag1 = "-1";
}
$k12_betmode = $_POST['k12_betmode'];
if ( $k12_betmode <= 0 )
{
    $k12_betmode = "0";
}
$k12_betwin = $_POST['k12_betwin'];
$k12_nobet1 = $_POST['k12_nobet1'];
$k12_nobet2 = $_POST['k12_nobet2'];
$k13_water = $_POST['k13_water'];
if ( $k13_water < 0 || 2 < $k13_water )
{
    $k13_water = 0;
}
$k13_water += 0;
$k13_minbet = $_POST['k13_minbet'];
if ( $k13_minbet < 1 )
{
    $k13_minbet = 10;
}
$k13_maxbet1 = $_POST['k13_maxbet1'];
if ( $k13_maxbet1 <= 0 )
{
    $k13_maxbet1 = "5000";
}
$k13_limit1 = $_POST['k13_limit1'];
if ( $k13_limit1 <= 0 )
{
    $k13_limit1 = "-1";
}
$k13_mag1 = $_POST['k13_mag1'];
if ( $k13_mag1 <= 0 )
{
    $k13_mag1 = "-1";
}
$k13_betmode = $_POST['k13_betmode'];
if ( $k13_betmode <= 0 )
{
    $k13_betmode = "0";
}
$k13_betwin = $_POST['k13_betwin'];
$k13_nobet1 = $_POST['k13_nobet1'];
$k13_nobet2 = $_POST['k13_nobet2'];
if ( $Lang == "iso-8859-2" )
{
    $typem[0] = "Admin";
}
else
{
    $typem[0] = "後庄";
}
if ( $Lang == "iso-8859-2" )
{
    $typem[1] = "Mjr Junket";
}
else
{
    $typem[1] = "大股东";
}
if ( $Lang == "iso-8859-2" )
{
    $typem[2] = "Junket";
}
else
{
    $typem[2] = "股东";
}
if ( $Lang == "iso-8859-2" )
{
    $typem[3] = "Main Agent";
}
else
{
    $typem[3] = "总代理";
}
if ( $Lang == "iso-8859-2" )
{
    $typem[4] = "Agent";
}
else
{
    $typem[4] = "代理商";
}
if ( $Lang == "iso-8859-2" )
{
    $typem[5] = "Member";
}
else
{
    $typem[5] = "会员";
}
$MaxRang = "@";
$MaxWater = "";
$MaxWater3 = "";
$MaxWater5 = "";
$MaxWater6 = "";
$MaxWater7 = "";
$MaxWater8 = "";
$MaxWater9 = "";
$MaxWater10 = "";
$message = "";
checkuid( $uid, $type - 1 );
if ( $MyData['State'] & 16 )
{
    $bSub = TRUE;
    if ( $MyData['Agent'] & 32 )
    {
        $ReadOnly = FALSE;
    }
    else if ( $MyData['Agent'] & 2 )
    {
        $ReadOnly = TRUE;
    }
    else
    {
        exit( );
    }
}
else
{
    $ReadOnly = FALSE;
    $bSub = FALSE;
}
if ( $type <= 1 )
{
    $boss = "host";
}
$AdjAccs = FALSE;
$st = substr( $CFG['AccsTime'], date( w ) * 11, 11 );
$nt = date( H, time( ) ).":".date( i, time( ) );
if ( substr( $st, 0, 5 ) <= $nt && $nt < substr( $st, 6, 5 ) )
{
    $AdjAccs = TRUE;
}
if ( $MyData['Level'] <= 0 && substr( $CFG['Check'], 1, 1 ) == "1" )
{
    $AdjAccs = TRUE;
}
if ( $type <= 4 )
{
    $k_credit *= 10000;
}
$notfound = "";
if ( strlen( $k_f ) != "" )
{
    if ( 0 < $MyData['Level'] )
    {
        $tr = " AND gTree like '%,".$MyData['Name'].",'";
    }
    else
    {
        $tr = "";
    }
    $result = mysql_query( "SELECT gBoss,gLevel FROM b_group WHERE (gName='{$k_f}' OR gNike='{$k_f}') AND gState&16=0{$tr} LIMIT 1", $comm );
    if ( 1 <= mysql_num_rows( $result ) )
    {
        $row = mysql_fetch_row( $result );
        $boss = $row[0];
        $type = $row[1];
    }
    else
    {
        $notfound = "&nbsp;<font style=\"BACKGROUND-COLOR: #ff0000\" color=ffffff>&nbsp;";
        if ( $Lang == "iso-8859-2" )
        {
            $notfound .= "[{$k_f}] not found";
        }
        else
        {
            $notfound .= big52gb( "找不到 [{$k_f}]" );
        }
        $notfound .= "&nbsp;</font>";
        $k_f = "";
    }
}
if ( $k_name != "" )
{
    if ( $k_mode == "Lock" )
    {
        mysql_query( "Update b_group SET gState=gState|2 WHERE gName='{$k_name}' LIMIT 1", $comm );
    }
    if ( $k_mode == "UnLock" )
    {
        mysql_query( "Update b_group SET gState=gState&4294967293 WHERE gName='{$k_name}' LIMIT 1", $comm );
    }
    if ( $k_mode == "RESETCOIN" )
    {
        $result = mysql_query( "SELECT gIn,gOut,gTree FROM b_group WHERE gName='{$k_name}' LIMIT 1", $comm );
        if ( 1 <= mysql_num_rows( $result ) )
        {
            $row = mysql_fetch_row( $result );
            mysql_query( "Update b_group SET gIn=0,gOut=0 WHERE gName='{$k_name}' LIMIT 1", $comm );
            mysql_query( "INSERT INTO b_log VALUES ('',2,'".$CFG['Unix']."','".$MyData['MyName']."','{$k_name} 开:{$row['0']} 洗:{$row['1']} 归零','{$UserIP}','{$row['2']}')", $comm );
        }
    }
    if ( $k_mode == "1" )
    {
        mysql_query( "Update b_group SET gState=gState|1 WHERE gState&1=0 AND (gName='{$k_name}' OR gTree like '%,{$k_name},%')", $comm );
    }
    if ( $k_mode == "2" )
    {
        $result = mysql_query( "SELECT gName FROM b_group WHERE gLevel=5 AND (gState&4 OR gState&128 OR gState&512 OR gState&65536 OR gState&131072 OR gState&524288) AND (gTree like '%,{$k_name},%' OR gName='{$k_name}') LIMIT 1", $comm );
        if ( 1 <= mysql_num_rows( $result ) )
        {
            $row = mysql_fetch_row( $result );
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( $row[0]." This user is currently playing so you cannot complete this action. The user must be logged out first!!" );
            }
            else
            {
                echoerror( $row[0]." 这位会员正在游戏中,禁止启用.若要启用会员必须登出游戏!!" );
            }
        }
        if ( $MyData['Level'] == 0 && $type == 5 )
        {
            mysql_query( "Update b_group SET gState=gState&4294765946,gErr=0,gGame2=0 WHERE gState&1 AND gName='{$k_name}'", $comm );
        }
        else
        {
            mysql_query( "Update b_group SET gState=gState&4294967294,gErr=0,gGame2=0 WHERE gState&1 AND (gName='{$k_name}' OR gTree like '%,{$k_name},%')", $comm );
        }
    }
    if ( $k_mode == "3" )
    {
        $result = mysql_query( "SELECT gName FROM b_group WHERE gLevel=5 AND (gState&4 OR gState&128 OR gState&512 OR gState&65536 OR gState&131072 OR gState&524288) AND (gTree like '%,{$k_name},%' OR gName='{$k_name}') LIMIT 1", $comm );
        if ( 1 <= mysql_num_rows( $result ) )
        {
            $row = mysql_fetch_row( $result );
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( $row[0]." This user is currently playing so you cannot complete this action. The user must be logged out first!!" );
            }
            else
            {
                echoerror( $row[0]." 这位会员正在游戏中,禁止启用.若要启用会员必须登出游戏!!" );
            }
        }
        $result = mysql_query( "SELECT gUse,gBoss,gLevel,gCredit,gBet,gTree,gState FROM b_group WHERE gName='{$k_name}' LIMIT 1", $comm );
        if ( 1 <= mysql_num_rows( $result ) )
        {
            $row = mysql_fetch_row( $result );
            if ( $row[0] <= 0 && $row[2] <= 4 || substr( $CFG['Check'], 5, 1 ) == "0" && $row[2] == 5 && $row[0] == $row[3] && $row[4] == 0 || substr( $CFG['Check'], 5, 1 ) == "1" && $row[2] == 5 && $row[0] == 0 && $row[4] == 0 )
            {
                mysql_query( "DELETE FROM b_group WHERE gName='{$k_name}' OR gTree like '%,{$k_name},%'", $comm );
                if ( 0 < $row[3] && 2 <= $row[2] )
                {
                    adjcredit( $row[1] );
                }
                mysql_query( "INSERT INTO b_log VALUES ('',3,'".$CFG['Unix']."','".$MyData['MyName']."','{$k_name} 删除','{$UserIP}','{$row['5']}')", $comm );
                if ( $row[2] == 5 && substr( $CFG['Check'], 20, 1 ) == "1" && ( $row[3] != 0 || $row[4] != 0 ) )
                {
                    if ( $row[6] & 8192 )
                    {
                        $iNo = 10000 + substr( sprintf( "%08d", $k_name ), 5, 3 );
                    }
                    else
                    {
                        $iNo = 0;
                    }
                    writecoin( 0, $row[0], $iNo + 0, $k_name, 0 );
                    if ( $Lang == "iso-8859-2" )
                    {
                        mysql_query( "INSERT INTO b_log VALUES ('',10,'".$CFG['Unix']."','Admin','MACH:000 Card:{$k_name} INST:{$row['0']}','{$UserIP}','".$MyData['MyName']."')", $comm );
                    }
                    else
                    {
                        mysql_query( "INSERT INTO b_log VALUES ('',10,'".$CFG['Unix']."','master','机号:000 卡号:{$k_name} 洗分:{$row['0']}','{$UserIP}','".$MyData['MyName']."')", $comm );
                    }
                }
            }
            else if ( $Lang == "iso-8859-2" )
            {
                echoerror( "{$k_name} credit already used up, therefore cannot delete. If you want to delete then please restore the user's credit." );
            }
            else
            {
                echoerror( "{$k_name} 的额度已使用,无法删除,若确定要删除,请先恢复额度." );
            }
        }
    }
    if ( $k_mode == "ROLL" )
    {
        $result = mysql_query( "SELECT gRang1,gName FROM b_group WHERE gLevel=5 AND (gName='{$k_name}' OR gTree like '%,{$k_name},%') AND (gGift<=0 OR gUse<=0)", $comm );
        do
        {
            do
            {
                if ( !( $row = mysql_fetch_row( $result ) ) )
                {
                    break;
                }
                else
                {
                    $roll = sprintf( "%d", $row[0] / 10 );
                }
                if ( $roll <= 0 )
                {
                    $roll = 0;
                }
                if ( 0 < $roll )
                {
                    if ( substr( $CFG['Check'], 9, 1 ) != "1" )
                    {
                        mysql_query( "Update b_group SET gUse=gUse+{$roll},gBet=0,gBetWin=0,gRang=0,gRang1=0 WHERE gName='{$row['1']}' LIMIT 1", $comm );
                        $s = "卡号:".$row[1]." 退水入余额:".$roll;
                        mysql_query( "INSERT INTO b_log VALUES ('',12,'".$CFG['Unix']."','管理站','{$s}','{$UserIP}','SYSTEM')", $comm );
                    }
                    else
                    {
                        mysql_query( "Update b_group SET gRang1=0 WHERE gName='{$row['1']}' LIMIT 1", $comm );
                    }
                }
            } while ( 1 );
        } while ( 0 );
    }
    if ( $k_mode == "ACCS" )
    {
        if ( ( substr( $CFG['Check'], 4, 1 ) == "1" || substr( $CFG['Check'], 8, 1 ) == "1" || substr( $CFG['Check'], 15, 1 ) == "1" || substr( $CFG['Check'], 16, 1 ) == "1" || substr( $CFG['Check'], 17, 1 ) == "1" || substr( $CFG['Check'], 26, 1 ) == "1" ) && substr( $CFG['Check'], 5, 1 ) != "1" )
        {
            if ( $k_name != "ALLUSERS" )
            {
                $result = mysql_query( "SELECT gName FROM b_group WHERE gLevel=5 AND (gState&1) AND (gTree like '%,{$k_name},%' OR gName='{$k_name}') LIMIT 1", $comm );
                if ( 1 <= mysql_num_rows( $result ) )
                {
                    $row = mysql_fetch_row( $result );
                    echoerror( $row[0]." 会员停用,禁止结算.!!" );
                }
                $result = mysql_query( "SELECT gName FROM b_group WHERE gLevel=5 AND (gState&4 OR gState&128 OR gState&512 OR gState&65536 OR gState&131072 OR gState&524288) AND (gTree like '%,{$k_name},%' OR gName='{$k_name}') LIMIT 1", $comm );
                if ( 1 <= mysql_num_rows( $result ) )
                {
                    $row = mysql_fetch_row( $result );
                    if ( $Lang == "iso-8859-2" )
                    {
                        echoerror( $row[0]." This user is currently playing so you cannot complete this action. The user must be logged out first!!" );
                    }
                    else
                    {
                        echoerror( $row[0]." 这位会员正在游戏中,禁止结算.若要结算会员必须登出游戏!!" );
                    }
                }
            }
            $acc = runaccs( $k_name );
            if ( $Lang == "iso-8859-2" )
            {
                $t_balance_t = "Balance";
            }
            else
            {
                $t_balance_t = big52gb( "结算" );
            }
            mysql_query( "INSERT INTO b_log VALUES ('',12,'".$CFG['Unix']."','".$MyData['MyName']."','{$k_name} {$t_balance_t}: {$acc}','{$UserIP}','')", $comm );
        }
        if ( substr( $CFG['Check'], 5, 1 ) == "1" )
        {
            if ( $k_name != "ALLUSERS" )
            {
                $result = mysql_query( "SELECT gName FROM b_group WHERE gLevel=5 AND (gState&4 OR gState&128 OR gState&512 OR gState&65536 OR gState&131072 OR gState&524288) AND (gTree like '%,{$k_name},%' OR gName='{$k_name}') LIMIT 1", $comm );
                if ( 1 <= mysql_num_rows( $result ) )
                {
                    $row = mysql_fetch_row( $result );
                    if ( $Lang == "iso-8859-2" )
                    {
                        echoerror( $row[0]." This user is currently playing so you cannot complete this action. The user must be logged out first!!" );
                    }
                    else
                    {
                        echoerror( $row[0]." 这位会员正在游戏中,禁止结算.若要结算会员必须登出游戏!!" );
                    }
                }
                $tr = "AND (rName='{$k_name}' OR rName1='{$k_name}' OR rName2='{$k_name}' OR rName3='{$k_name}' OR rName4='{$k_name}')";
                mysql_query( "Update b_group SET gGame2=0,gBet=0,gBetWin=0 WHERE gLevel=5 AND (gTree like '%,{$k_name},%' OR gName='{$k_name}')", $comm );
            }
            else
            {
                mysql_query( "Update b_group SET gGame2=0,gBet=0,gBetWin=0 WHERE gLevel=5", $comm );
                $tr = "";
            }
            mysql_query( "Update b_report SET rState=rState|4 WHERE rState&2 AND rState&4=0 {$tr}", $comm );
            mysql_query( "INSERT INTO b_log VALUES ('',12,'".$CFG['Unix']."','".$MyData['MyName']."','{$k_name} {$t_balance_t}','{$UserIP}','')", $comm );
        }
    }
    if ( ( $k_mode == "UP" || $k_mode == "UPD" || $k_mode == "DOWN" ) && $type == 5 )
    {
        $result = mysql_query( "SELECT gState,gBoss,gCredit,gUse,gGame2,gTree,gRebate,gGift FROM b_group WHERE gName='{$k_name}' LIMIT 1", $comm );
        if ( 1 <= mysql_num_rows( $result ) )
        {
            $row = mysql_fetch_row( $result );
            $boss = $row[1];
            if ( $k_mode == "DOWN" )
            {
                if ( $row[0] & 1 == 1 )
                {
                    echoerror( "此会员停用,禁止洗分!!" );
                }
                if ( 0 < $row[3] && 0 < $row[7] )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echoerror( "开赠模式,禁止洗分!!" );
                    }
                    else
                    {
                        echoerror( "此会员目前为开赠模式,尚有余额:".$row[3].",请由机台洗分(如果己达洗分门槛)!!" );
                    }
                }
                if ( $row[0] & 4 || $row[0] & 128 || $row[0] & 512 || $row[0] & 65536 || $row[0] & 131072 || $row[0] & 524288 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echoerror( $row[0]." This user is currently playing so you cannot complete this action. The user must be logged out first!!" );
                    }
                    else
                    {
                        echoerror( "这位会员正在游戏中,禁止洗分.若要洗分请先登出!!" );
                    }
                }
                if ( substr( $CFG['Check'], 5, 1 ) == "0" )
                {
                    if ( $row[2] - $k_ud < $CFG['CreditMin'] && 0 < $CFG['CreditMin'] )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "Credit has to be greater than:".cfg_number( $CFG['CreditMin'], 0, 0, FALSE ) );
                        }
                        else
                        {
                            echoerror( "开分点数不得低於公司设定的:".cfg_number( $CFG['CreditMin'], 0, 0, FALSE )." 点" );
                        }
                    }
                    if ( 1 == 1 )
                    {
                        if ( $row[3] < $k_ud )
                        {
                            if ( $Lang == "iso-8859-2" )
                            {
                                echoerror( "Sorry, cannot be greater than the present credit!!" );
                            }
                            else
                            {
                                echoerror( "洗分点数不能大於目前点数!!" );
                            }
                        }
                        $cr = "gCredit=gCredit-{$k_ud},gUse=gUse-{$k_ud}";
                    }
                    else
                    {
                        $u = sprintf( "%d", $row[3] - $k_ud );
                        if ( $u < 0 )
                        {
                            $u = 0;
                        }
                        $c = sprintf( "%d", $row[2] - $k_ud );
                        if ( $c <= 0 || $u <= 0 )
                        {
                            $c = 0;
                        }
                        $cr = "gCredit={$c},gUse={$u}";
                    }
                }
                else
                {
                    if ( $row[3] < $k_ud )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "Sorry, cannot be greater than the present credit!" );
                        }
                        else
                        {
                            echoerror( "洗分点数不能大於目前点数!" );
                        }
                    }
                    $cr = "gUse=gUse-{$k_ud}";
                }
                $score = $row[3] - $k_ud;
                mysql_query( "Update b_group SET {$cr} WHERE gName='{$k_name}' LIMIT 1", $comm );
                if ( substr( $CFG['Check'], 20, 1 ) == "1" )
                {
                    if ( $row[0] & 8192 )
                    {
                        $iNo = 10000 + substr( sprintf( "%08d", $k_name ), 5, 3 );
                    }
                    else
                    {
                        $iNo = 0;
                    }
                    writecoin( 0, $k_ud, $iNo + 0, $k_name, 0 );
                }
                if ( substr( $CFG['Check'], 27, 1 ) == "1" )
                {
                    mysql_query( "Update m_state SET sUpdate=sUpdate|2 WHERE sId=1", $comm );
                    if ( substr( $CFG['Check'], 16, 1 ) == "1" )
                    {
                        mysql_query( "Update m9_state SET sUpdate=sUpdate|2 WHERE sId=1", $comm );
                    }
                    if ( substr( $CFG['Check'], 17, 1 ) == "1" )
                    {
                        mysql_query( "Update m3_state SET sUpdate=sUpdate|2 WHERE sId=1", $comm );
                    }
                    if ( substr( $CFG['Check'], 26, 1 ) == "1" )
                    {
                        mysql_query( "Update ms_state SET sUpdate=sUpdate|2 WHERE sId=1", $comm );
                    }
                }
                if ( $Lang == "iso-8859-2" )
                {
                    mysql_query( "INSERT INTO b_log VALUES ('',10,'".$CFG['Unix']."','Admin','MACH:000 Card:{$k_name} INST:{$k_ud}','{$UserIP}','".$MyData['MyName']."')", $comm );
                }
                else
                {
                    mysql_query( "INSERT INTO b_log VALUES ('',10,'".$CFG['Unix']."','master','机号:000 卡号:{$k_name} 洗分:{$k_ud}','{$UserIP}','".$MyData['MyName']."')", $comm );
                }
            }
            if ( $k_mode == "UP" || $k_mode == "UPD" && 0 < $CFG['Rebate'] )
            {
                if ( $row[0] & 1 == 1 )
                {
                    echoerror( "此会员停用,禁止上分!!" );
                }
                if ( 0 < $row[3] && 0 < $row[7] )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echoerror( "开赠模式,禁止上分!!" );
                    }
                    else
                    {
                        echoerror( "此会员目前为开赠模式,尚有余额:".$row[7].",禁止上分!!" );
                    }
                }
                if ( ( $k_mode == "UP" && $CFG['CreditMax'] < $row[2] + $k_ud || $k_mode == "UPD" && $CFG['CreditMax'] < $row[6] + $k_ud ) && 0 < $CFG['CreditMax'] )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echoerror( "Start credit cannot be greater than:".cfg_number( $CFG['CreditMax'], 0, 0, FALSE ) );
                    }
                    else
                    {
                        echoerror( "开分点数不得大於公司设定的:".cfg_number( $CFG['CreditMax'], 0, 0, FALSE )." 点" );
                    }
                }
                $result2 = mysql_query( "SELECT gCredit,gUse FROM b_group WHERE gName='{$boss}' LIMIT 1", $comm );
                if ( 1 <= mysql_num_rows( $result2 ) )
                {
                    $row2 = mysql_fetch_row( $result2 );
                    $score = $row2[0] - $row2[1];
                    if ( $score < $k_ud )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "Increased Credit:{$k_ud} Cannot be greater than Agent amount: {$score}" );
                        }
                        else
                        {
                            echoerror( "上分点数:{$k_ud} 不能大於代理商可用额度:{$score}" );
                        }
                    }
                    if ( $k_mode == "UP" )
                    {
                        mysql_query( "Update b_group SET gCredit=gCredit+{$k_ud},gUse=gUse+{$k_ud} WHERE gName='{$k_name}' LIMIT 1", $comm );
                        mysql_query( "Update m_users SET uCredit=uCredit+{$k_ud} WHERE uName='{$k_name}' LIMIT 1", $comm );
                    }
                    if ( $k_mode == "UPD" )
                    {
                        $kud = sprintf( "%.0f", $k_ud + $k_ud * ( $CFG['Rebate'] / 100 ) );
                        mysql_query( "Update b_group SET gRebate=gRebate+{$kud} WHERE gName='{$k_name}' LIMIT 1", $comm );
                    }
                    if ( substr( $CFG['Check'], 20, 1 ) == "1" )
                    {
                        if ( $row[0] & 8192 )
                        {
                            $iNo = 10000 + substr( sprintf( "%08d", $k_name ), 5, 3 );
                        }
                        else
                        {
                            $iNo = 0;
                        }
                        if ( $k_mode == "UP" )
                        {
                            writecoin( $k_ud, 0, $iNo + 0, $k_name, 0 );
                        }
                        else
                        {
                            writecoin( $k_ud, 0, $iNo + 0, $k_name, 1 );
                        }
                    }
                    if ( substr( $CFG['Check'], 27, 1 ) == "1" )
                    {
                        mysql_query( "Update m_state SET sUpdate=sUpdate|2 WHERE sId=1", $comm );
                        if ( substr( $CFG['Check'], 16, 1 ) == "1" )
                        {
                            mysql_query( "Update m9_state SET sUpdate=sUpdate|2 WHERE sId=1", $comm );
                        }
                        if ( substr( $CFG['Check'], 17, 1 ) == "1" )
                        {
                            mysql_query( "Update m3_state SET sUpdate=sUpdate|2 WHERE sId=1", $comm );
                        }
                        if ( substr( $CFG['Check'], 26, 1 ) == "1" )
                        {
                            mysql_query( "Update ms_state SET sUpdate=sUpdate|2 WHERE sId=1", $comm );
                        }
                    }
                    if ( $k_mode == "UP" )
                    {
                        $stru = "";
                    }
                    else if ( $Lang == "iso-8859-2" )
                    {
                        $stru = "gRebate";
                    }
                    else
                    {
                        $stru = "死码";
                    }
                    if ( $Lang == "iso-8859-2" )
                    {
                        mysql_query( "INSERT INTO b_log VALUES ('',11,'".$CFG['Unix']."','master','MACH:000 Card:{$k_name} {$stru} Inst:{$k_ud}','{$UserIP}','".$MyData['MyName']."')", $comm );
                    }
                    else
                    {
                        mysql_query( "INSERT INTO b_log VALUES ('',11,'".$CFG['Unix']."','master','机号:000 卡号:{$k_name} {$stru} 上分:{$k_ud}','{$UserIP}','".$MyData['MyName']."')", $comm );
                    }
                }
            }
            adjcredit( $boss );
        }
    }
    if ( ( $k_mode == "5" || $k_mode == "55" || $k_mode == "6" || $k_mode == "66" ) && $k_cname != "" && $k_passwd != "" && $k_credit != "" && substr( $CFG['Check'], 24, 1 ) == "1" && $type == 5 )
    {
        $k_name = strtolower( $k_name );
        $my_data = explode( "@", $k_data );
        $lwsql0 = "SELECT gName,gData FROM b_group WHERE gLevel=5 AND gPass='{$k_passwd}' AND gName<>'{$k_name}'";
        $result = mysql_query( $lwsql0, $comm );
        do
        {
            do
            {
                do
                {
                    if ( !( $row = mysql_fetch_row( $result ) ) )
                    {
                        break;
                    }
                    else
                    {
                        $u_data = explode( "@", $row[1] );
                        $i = 0;
                        do
                        {
                            if ( $i < sizeof( $my_data ) )
                            {
                                if ( 8 <= strlen( $my_data[$i] ) )
                                {
                                    $ii = 0;
                                    while ( $ii < sizeof( $u_data ) )
                                    {
                                        if ( 8 <= strlen( $u_data[$ii] ) && $my_data[$i] == $u_data[$ii] )
                                        {
                                            if ( $Lang == "iso-8859-2" )
                                            {
                                                echoerror( "The password {$k_passwd} is already taken, please choose another password!" );
                                            }
                                            else
                                            {
                                                echoerror( "会员密码({$k_passwd})与 {$row['0']} 这个帐号重覆,且扩充栏位内的资料也重覆了,请修改密码或扩充栏位,否则将造成游戏登入认证资料重覆." );
                                            }
                                            break;
                                        }
                                        ++$ii;
                                    }
                                }
                                else
                                {
                                    break;
                                }
                                ++$i;
                            }
                        } while ( 1 );
                    }
                } while ( 1 );
            } while ( 0 );
        } while ( 0 );
    }
    if ( ( $k_mode == "5" || $k_mode == "55" ) && $k_cname != "" && $k_passwd != "" )
    {
        $k_name = strtolower( $k_name );
        if ( $type == 5 )
        {
            if ( $k_credit < $CFG['CreditMin'] && 0 < $CFG['CreditMin'] )
            {
                if ( $Lang == "iso-8859-2" )
                {
                    echoerror( "Member amount must not be lower than:".cfg_number( $CFG['CreditMin'], 0, 0, FALSE ) );
                }
                else
                {
                    echoerror( "会员额度不得低於公司设定的:".cfg_number( $CFG['CreditMin'], 0, 0, FALSE )." 点" );
                }
            }
            if ( $CFG['CreditMax'] < $k_credit && 0 < $CFG['CreditMax'] )
            {
                if ( $Lang == "iso-8859-2" )
                {
                    echoerror( "Member amount must not be greater than:".cfg_number( $CFG['CreditMax'], 0, 0, FALSE )." 点" );
                }
                else
                {
                    echoerror( "会员额度不得大於公司设定的:".cfg_number( $CFG['CreditMax'], 0, 0, FALSE )." 点" );
                }
            }
        }
        if ( $type == 3 && substr( $k_name, 1, 3 ) == "000" )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( "Main Agent account number must start from 001!" );
            }
            else
            {
                echoerror( "总代理帐号必须由001开始!" );
            }
        }
        if ( $type == 4 && substr( $k_name, 4, 2 ) == "00" )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( "Agent account number must start from 01!" );
            }
            else
            {
                echoerror( "代理商帐号必须由01开始!" );
            }
        }
        if ( $type == 5 && substr( $k_name, 5, 3 ) == "000" )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( "Member account number must start from 001!" );
            }
            else
            {
                echoerror( "会员帐号必须由001开始!" );
            }
        }
        if ( substr( $k_name, 0, 1 ) == "s" )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( "Please do not start the first character with the letter \"s\" because this is reserved for account type!" );
            }
            else
            {
                echoerror( "帐号第1码请不要用 s 开头,因为这是子帐号分类!" );
            }
        }
        if ( substr( $k_name, 0, 4 ) == "host" )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( "The account \"host\" is already taken by the system and can therefore not be used!" );
            }
            else
            {
                echoerror( "host 开头的帐号为系统专用,您不可使用这个帐号!" );
            }
        }
        if ( $boss == "" )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( "While processing this request the system encountered an error. It may be that the system is very busy at the moment. Please try again!" );
            }
            else
            {
                echoerror( "传送表单时发生错误(可能系统太繁忙),请重新操作一次!" );
            }
        }
        $result = mysql_query( "SELECT gName FROM b_group WHERE gName='{$k_name}' LIMIT 1", $comm );
        if ( 1 <= mysql_num_rows( $result ) )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( "The account \$k_name is already taken, please choose another name!" );
            }
            else
            {
                echoerror( "{$k_name} 帐号已存在,不能重覆新增,请选用其他帐号!" );
            }
        }
        $cc = 0;
        if ( $k_betwin1 == 1 )
        {
            $cc = $cc | 8;
        }
        if ( $k_ck01 == 1 )
        {
            $cc = $cc | 32;
        }
        if ( $k_order == 1 )
        {
            $cc = $cc | 64;
        }
        if ( $k_betwin2 == 1 )
        {
            $cc = $cc | 1024;
        }
        if ( $k_betwin3 == 1 )
        {
            $cc = $cc | 2048;
        }
        if ( $k_ck8192 == 1 )
        {
            $cc = $cc | 8192;
        }
        if ( $k6_betwin == 1 )
        {
            $cc = $cc | 16384;
        }
        if ( $k7_betwin == 1 )
        {
            $cc = $cc | 32768;
        }
        if ( $k8_betwin == 1 )
        {
            $cc = $cc | 262144;
        }
        if ( $k9_betwin == 1 )
        {
            $cc = $cc | 1048576;
        }
        if ( $k10_betwin == 1 )
        {
            $cc = $cc | 4194304;
        }
        if ( $k11_betwin == 1 )
        {
            $cc = $cc | 16777216;
        }
        if ( $k12_betwin == 1 )
        {
            $cc = $cc | 67108864;
        }
        if ( $k13_betwin == 1 )
        {
            $cc = $cc | 268435456;
        }
        $up = $boss;
        $tree = ",";
        $gid = 0;
        $game1 = "";
        $game5 = "";
        $i = $type;
        while ( 0 <= $i )
        {
            $result = mysql_query( "SELECT gRang,gBoss,gName,gLevel,gCredit,gUse,gSno,gGame1,gGame3,gGame5,gGame6,gGame7,gGame8,gGame9,gGame10,gGame11,gGame12,gGame13 FROM b_group WHERE gName='{$up}' LIMIT 1", $comm );
            if ( 1 <= mysql_num_rows( $result ) )
            {
                $row = mysql_fetch_row( $result );
                if ( $MaxRang == 0 - 1 || $MaxRang == "@" )
                {
                    $MaxRang = $row[0];
                }
                if ( 1 <= $row[3] && $row[3] <= 4 )
                {
                    $tree = ",".$row[2].$tree;
                }
                if ( $row[2] == $boss && 2 <= $type )
                {
                    $s = explode( ",", $row[7] );
                    $MaxWater = $s[0] + 0;
                    if ( $MaxWater < $k_water && substr( $CFG['Check'], 4, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[Baccarat] Rolling value: \$k_water, cannot be greater than \$MaxWater !!" );
                        }
                        else
                        {
                            echoerror( "[百家乐]退水:{$k_water} ,不可大於上线退水:{$MaxWater} !!" );
                        }
                    }
                    $s = explode( ",", $row[8] );
                    $MaxWater3 = $s[0] + 0;
                    if ( $MaxWater3 < $k3_water && substr( $CFG['Check'], 8, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[ChuHan] Rolling value: {$k3_water}, cannot be greater than {$MaxWater3} !!" );
                        }
                        else
                        {
                            echoerror( "[楚汉]退水:{$k3_water} ,不可大於上线退水:{$MaxWater3} !!" );
                        }
                    }
                    $s = explode( ",", $row[9] );
                    $MaxWater5 = $s[0] + 0;
                    if ( $MaxWater5 < $k5_water && substr( $CFG['Check'], 15, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[Roulette] Rolling value: {$k5_water}, cannot be greater than {$MaxWater5} !!" );
                        }
                        else
                        {
                            echoerror( "[轮盘]退水:{$k5_water} ,不可大於上线退水:{$MaxWater5} !!" );
                        }
                    }
                    $s = explode( ",", $row[10] );
                    $MaxWater6 = $s[0] + 0;
                    if ( $MaxWater6 < $k6_water && substr( $CFG['Check'], 16, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[Up9] Rolling value: {$k6_water}, cannot be greater than {$MaxWater6} !!" );
                        }
                        else
                        {
                            echoerror( "[九仔升]退水:{$k6_water} ,不可大於上线退水:{$MaxWater6} !!" );
                        }
                    }
                    $s = explode( ",", $row[11] );
                    $MaxWater7 = $s[0] + 0;
                    if ( $MaxWater7 < $k7_water && substr( $CFG['Check'], 17, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[3Card] Rolling value: {$k7_water}, cannot be greater than {$MaxWater7} !!" );
                        }
                        else
                        {
                            echoerror( "[三公]退水:{$k7_water} ,不可大於上线退水:{$MaxWater7} !!" );
                        }
                    }
                    $s = explode( ",", $row[12] );
                    $MaxWater8 = $s[0] + 0;
                    if ( $MaxWater8 < $k8_water && substr( $CFG['Check'], 26, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[3Card] Rolling value: {$k8_water}, cannot be greater than {$MaxWater8} !!" );
                        }
                        else
                        {
                            echoerror( "[骰宝]退水:{$k8_water} ,不可大於上线退水:{$MaxWater8} !!" );
                        }
                    }
                    $s = explode( ",", $row[13] );
                    $MaxWater9 = $s[0] + 0;
                    if ( $MaxWater9 < $k9_water && substr( $CFG['Check'], 28, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[DICE-3] Rolling value: {$k9_water}, cannot be greater than {$MaxWater9} !!" );
                        }
                        else
                        {
                            echoerror( "[18豆(3)]退水:{$k9_water} ,不可大於上线退水:{$MaxWater9} !!" );
                        }
                    }
                    $s = explode( ",", $row[14] );
                    $MaxWater10 = $s[0] + 0;
                    if ( $MaxWater10 < $k10_water && substr( $CFG['Check'], 29, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[DICE-4] Rolling value: {$k10_water}, cannot be greater than {$MaxWater10} !!" );
                        }
                        else
                        {
                            echoerror( "[18豆(4)]退水:{$k10_water} ,不可大於上线退水:{$MaxWater10} !!" );
                        }
                    }
                    $s = explode( ",", $row[15] );
                    $MaxWater11 = $s[0] + 0;
                    if ( $MaxWater11 < $k11_water && substr( $CFG['Check'], 34, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[Domino TienGow] Rolling value: {$k11_water}, cannot be greater than {$MaxWater11} !!" );
                        }
                        else
                        {
                            echoerror( "[骨牌天九]退水:{$k11_water} ,不可大於上线退水:{$MaxWater11} !!" );
                        }
                    }
                    $s = explode( ",", $row[16] );
                    $MaxWater12 = $s[0] + 0;
                    if ( $MaxWater12 < $k12_water && substr( $CFG['Check'], 35, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[TienGow] Rolling value: {$k12_water}, cannot be greater than {$MaxWater12} !!" );
                        }
                        else
                        {
                            echoerror( "[天九]退水:{$k12_water} ,不可大於上线退水:{$MaxWater12} !!" );
                        }
                    }
                    $s = explode( ",", $row[17] );
                    $MaxWater13 = $s[0] + 0;
                    if ( $MaxWater13 < $k13_water && substr( $CFG['Check'], 36, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[PushTong] Rolling value: {$k13_water}, cannot be greater than {$MaxWater13} !!" );
                        }
                        else
                        {
                            echoerror( "[推筒子]退水:{$k13_water} ,不可大於上线退水:{$MaxWater13} !!" );
                        }
                    }
                    $Credit = $row[4] - $row[5];
                    if ( $Credit < $k_credit )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "Total credit amount: \$k_credit, cannot be greater than \$Credit !!" );
                        }
                        else
                        {
                            echoerror( sprintf( "总信用额度:%d 万 ,不可大於上线可用额度:%d 万 !!", $k_credit / 10000, $Credit / 10000 ) );
                        }
                    }
                }
                $up = $row[1];
                if ( $row[3] == 1 )
                {
                    $gid = $row[6];
                }
                if ( $row[3] == 0 )
                {
                    break;
                }
            }
            --$i;
        }
        if ( $type <= 3 && $MaxRang < $k_rang )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( "Biggest share % rate:".$k_rang."% cannot be bigger than: ".$MaxRang."% !" );
            }
            else
            {
                echoerror( "最大占成数:".$k_rang."% 不可大於上线占成数: ".$MaxRang."% !" );
            }
        }
        if ( $type == 4 )
        {
            $n = $k_rang + $k_rang1;
            if ( $MaxRang < $n )
            {
                if ( $Lang == "iso-8859-2" )
                {
                    echoerror( "agent + main agent share % rate:".$k_rang."% cannot be bigger than: ".$MaxRang."% !" );
                }
                else
                {
                    echoerror( "代理商+总代理占成数:".$n."% 不可大於上线最大占成数: ".$MaxRang."% !" );
                }
            }
            if ( substr( $CFG['Check'], 0, 1 ) != "1" && $n != $MaxRang )
            {
                if ( $Lang == "iso-8859-2" )
                {
                    echoerror( "[agent+main agent]share % rate must equal: ".$MaxRang."%" );
                }
                else
                {
                    echoerror( "目前设定[代理商+总代理]占成数必须等於总代理最大占成数: ".$MaxRang."%" );
                }
            }
        }
        $game1 = "{$k_water},{$k_minbet},{$k_maxbet1},{$k_maxbet2},{$k_maxbet3}";
        if ( $type != 1 )
        {
            $game1 = $game1.",{$k_maxbet4}";
        }
        $game2 = 0;
        $game3 = "{$k3_water},{$k3_minbet},{$k3_maxbet1},{$k3_maxbet2},{$k3_maxbet3}";
        $game5 = "{$k5_water},{$k5_minbet},{$k5_maxbet1},{$k5_maxbet2},{$k5_maxbet3},{$k5_maxbet4},{$k5_maxbet5},{$k5_maxbet6},{$k5_maxbet7}";
        $game6 = "{$k6_water},{$k6_minbet},{$k6_maxbet1},{$k6_maxbet2},{$k6_maxbet3}";
        $game7 = "{$k7_water},{$k7_minbet},{$k7_maxbet1},{$k7_maxbet2},{$k7_maxbet3},{$k7_maxbet4},{$k7_maxbet5},{$k7_maxbet6}";
        $game8 = "{$k8_water},{$k8_minbet},{$k8_maxbet1},{$k8_maxbet2},{$k8_maxbet3},{$k8_maxbet4},{$k8_maxbet5},{$k8_maxbet6},{$k8_maxbet7}";
        $game9 = "{$k9_water},{$k9_minbet},{$k9_maxbet1},{$k9_maxbet2},{$k9_maxbet3},{$k9_maxbet4}";
        $game10 = "{$k10_water},{$k10_minbet},{$k10_maxbet1},{$k10_maxbet2},{$k10_maxbet3},{$k10_maxbet4}";
        $game11 = "{$k11_water},{$k11_minbet},{$k11_maxbet1}";
        $game12 = "{$k12_water},{$k12_minbet},{$k12_maxbet1}";
        $game13 = "{$k13_water},{$k13_minbet},{$k13_maxbet1}";
        if ( $type <= 1 )
        {
            $k_room = 0;
            if ( substr( $CFG['Check'], 12, 1 ) == "1" )
            {
                $qs = "";
                $i = 20;
                while ( 1 <= $i )
                {
                    $qss = sprintf( "k_ck%02d", $i );
                    $var = $_POST["{$qss}"];
                    if ( $var == 1 )
                    {
                        $qs .= "1";
                    }
                    else
                    {
                        $qs .= "0";
                    }
                    --$i;
                }
                $k_room = bindec( $qs );
            }
            else
            {
                if ( $k_ck01 == 1 )
                {
                    $k_room = $k_room | 1;
                }
                if ( $k_ck02 == 1 )
                {
                    $k_room = $k_room | 2;
                }
                if ( $k_ck03 == 1 )
                {
                    $k_room = $k_room | 4;
                }
            }
            $game1 = $game1.",{$k_limit1},{$k_limit2},{$k_limit3},{$k_room},0,0,0,{$k_betmode},{$k_mag1},{$k_mag2},{$k_mag3},{$k_nobet1},{$k_nobet2},{$k_nobet3},{$k_nobet4},{$k_nobet5},{$k_maxbet4},{$k_limit4},{$k_mag4}";
            $k3_room = 0;
            if ( $k3_ck01 == 1 )
            {
                $k3_room = $k3_room | 1;
            }
            if ( $k3_ck02 == 1 )
            {
                $k3_room = $k3_room | 2;
            }
            if ( $k3_ck03 == 1 )
            {
                $k3_room = $k3_room | 4;
            }
            $game3 = $game3.",{$k3_limit1},{$k3_limit2},{$k3_limit3},{$k3_room}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k5_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k5_room = bindec( $qs );
            $game5 = $game5.",{$k5_limit1},{$k5_limit2},{$k5_limit3},{$k5_limit4},{$k5_limit5},{$k5_limit6},{$k5_limit7},{$k5_mag1},{$k5_mag2},{$k5_mag3},{$k5_mag4},{$k5_mag5},{$k5_mag6},{$k5_mag7},{$k5_room},{$k5_betmode},0";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k6_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k6_room = bindec( $qs );
            $game6 = $game6.",{$k6_limit1},{$k6_limit2},{$k6_limit3},{$k6_mag1},{$k6_mag2},{$k6_mag3},{$k6_room},{$k6_betmode},{$k6_nobet1},{$k6_nobet2},0,0,0";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k7_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k7_room = bindec( $qs );
            $game7 = $game7.",{$k7_limit1},{$k7_limit2},{$k7_limit3},{$k7_limit4},{$k7_limit5},{$k7_limit6},{$k7_mag1},{$k7_mag2},{$k7_mag3},{$k7_mag4},{$k7_mag5},{$k7_mag6},{$k7_room},{$k7_betmode},{$k7_nobet1},{$k7_nobet2},0,0,0,0,0,0";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k8_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k8_room = bindec( $qs );
            $game8 = $game8.",{$k8_limit1},{$k8_limit2},{$k8_limit3},{$k8_limit4},{$k8_limit5},{$k8_limit6},{$k8_limit7},{$k8_mag1},{$k8_mag2},{$k8_mag3},{$k8_mag4},{$k8_mag5},{$k8_mag6},{$k8_mag7},{$k8_room},{$k8_betmode},{$k8_nobet1},{$k8_nobet2},0,0,0,0,0,0";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k9_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k9_room = bindec( $qs );
            $game9 = $game9.",{$k9_limit1},{$k9_limit2},{$k9_limit3},{$k9_limit4},{$k9_mag1},{$k9_mag2},{$k9_mag3},{$k9_mag4},{$k9_room},{$k9_betmode},{$k9_nobet1},{$k9_nobet2},0,0,0,0";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k10_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k10_room = bindec( $qs );
            $game10 = $game10.",{$k10_limit1},{$k10_limit2},{$k10_limit3},{$k10_limit4},{$k10_mag1},{$k10_mag2},{$k10_mag3},{$k10_mag4},{$k10_room},{$k10_betmode},{$k10_nobet1},{$k10_nobet2},0,0,0,0";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k11_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k11_room = bindec( $qs );
            $game11 = $game11.",{$k11_limit1},{$k11_mag1},{$k11_room},{$k11_betmode},{$k11_nobet1},{$k11_nobet2},0";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k12_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k12_room = bindec( $qs );
            $game12 = $game12.",{$k12_limit1},{$k12_mag1},{$k12_room},{$k12_betmode},{$k12_nobet1},{$k12_nobet2},0";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k13_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k13_room = bindec( $qs );
            $game13 = $game13.",{$k13_limit1},{$k13_mag1},{$k13_room},{$k13_betmode},{$k13_nobet1},{$k13_nobet2},0";
        }
        if ( $type == 5 )
        {
            if ( substr( $CFG['Check'], 5, 1 ) == "0" )
            {
                $score = $k_credit;
            }
            else
            {
                $score = 0;
            }
        }
        else
        {
            $score = 0;
        }
        if ( $type <= 1 )
        {
            $gid = $k_unit;
        }
        mysql_query( "INSERT INTO b_group VALUES ('','{$type}','{$k_name}','{$k_passwd}','{$k_cname}','{$k_rang}','{$k_rang1}','{$cc}','{$k_credit}','{$score}','0','0','".$CFG['Unix']."','0','0','','{$gid}','{$boss}','{$tree}','0','0','0','','{$game1}','{$game2}','{$game3}','{$game5}','{$k_data}','{$game6}','{$game7}',0,0,'{$game8}','{$game9}','{$game10}','0','{$game11}','{$game12}','{$game13}','0')", $comm );
        if ( $type == 5 && substr( $CFG['Check'], 20, 1 ) == "1" && 0 < $k_credit )
        {
            if ( $k_ck8192 == 1 )
            {
                $iNo = 10000 + substr( sprintf( "%08d", $k_name ), 5, 3 );
            }
            else
            {
                $iNo = 0;
            }
            writecoin( $k_credit, 0, $iNo + 0, $k_name, 0 );
            if ( $Lang == "iso-8859-2" )
            {
                mysql_query( "INSERT INTO b_log VALUES ('',11,'".$CFG['Unix']."','master','MACH:000 Card:{$k_name} Inst:{$k_credit}','{$UserIP}','".$MyData['MyName']."')", $comm );
            }
            else
            {
                mysql_query( "INSERT INTO b_log VALUES ('',11,'".$CFG['Unix']."','master','机号:000 卡号:{$k_name} 上分:{$k_credit}','{$UserIP}','".$MyData['MyName']."')", $comm );
            }
        }
        if ( 0 < $k_credit && 2 <= $type )
        {
            adjcredit( $boss );
        }
        mysql_query( "INSERT INTO b_log VALUES ('',3,'".$CFG['Unix']."','".$MyData['MyName']."','".$typem[$MyData['Level']]."新增".$typem[$type].":{$k_name} 额度:{$k_credit}','{$UserIP}','{$tree}')", $comm );
    }
    if ( ( $k_mode == "6" || $k_mode == "66" ) && $k_cname != "" && $k_passwd != "" && $k_credit != "" )
    {
        $result = mysql_query( "SELECT gState,gBoss,gCredit,gUse,gGame1,gGame3,gTree,gGame5,gGame6,gGame7,gGame8,gGame9,gGame10,gGame11,gGame12,gGame13 FROM b_group WHERE gName='{$k_name}' LIMIT 1", $comm );
        if ( 1 <= mysql_num_rows( $result ) )
        {
            $row = mysql_fetch_row( $result );
            if ( $type <= 4 && 0 < $k_credit )
            {
                $ary1 = gettreecredit( $k_name, 0 - 1 );
                $Use = $ary1[1];
                if ( $type == 4 )
                {
                    $ary1[1] = $ary1[2];
                }
                if ( $k_credit < $ary1[1] )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echoerror( "[Credit Amount:{$k_credit}] cannot be less than [Used Credit:".$ary1[1]."]!" );
                    }
                    else
                    {
                        echoerror( sprintf( "[信用额度:%d 万] 不能低於 [已用额度:%d 万!", $k_credit / 10000, $ary1[1] / 10000 ) );
                    }
                }
            }
            $state = $row[0];
            if ( $k_order == 1 )
            {
                $state = $state | 64;
            }
            else
            {
                $state = $state & 4.29497e+009 - 64;
            }
            if ( $k_ck01 == 1 )
            {
                $state = $state | 32;
            }
            else
            {
                $state = $state & 4.29497e+009 - 32;
            }
            if ( $k_betwin1 == 1 )
            {
                $state = $state | 8;
            }
            else
            {
                $state = $state & 4.29497e+009 - 8;
            }
            if ( $k_betwin2 == 1 )
            {
                $state = $state | 1024;
            }
            else
            {
                $state = $state & 4.29497e+009 - 1024;
            }
            if ( $k_betwin3 == 1 )
            {
                $state = $state | 2048;
            }
            else
            {
                $state = $state & 4.29497e+009 - 2048;
            }
            if ( $k_ck8192 == 1 )
            {
                $state = $state | 8192;
            }
            else
            {
                $state = $state & 4.29497e+009 - 8192;
            }
            if ( $k6_betwin == 1 )
            {
                $state = $state | 16384;
            }
            else
            {
                $state = $state & 4.29497e+009 - 16384;
            }
            if ( $k7_betwin == 1 )
            {
                $state = $state | 32768;
            }
            else
            {
                $state = $state & 4.29497e+009 - 32768;
            }
            if ( $k8_betwin == 1 )
            {
                $state = $state | 262144;
            }
            else
            {
                $state = $state & 4.29497e+009 - 262144;
            }
            $boss = $row[1];
            $Credit = $row[2];
            $MyTree = $row[6];
            $s = explode( ",", $row[4] );
            if ( $type == 1 )
            {
                $k_alarm1 = $s[9];
                $k_alarm2 = $s[10];
                $k_alarm3 = $s[11];
            }
            else
            {
                $k_alarm1 = $s[5];
                $k_alarm2 = $s[6];
                $k_alarm3 = $s[7];
            }
            $s = explode( ",", $row[5] );
            if ( $type == 1 )
            {
                $k3_alarm1 = $s[9];
            }
            else
            {
                $k3_alarm1 = $s[5];
            }
            $s = explode( ",", $row[7] );
            if ( $type == 1 )
            {
                $k5_alarm1 = $s[25];
            }
            else
            {
                $k3_alarm1 = $s[9];
            }
            $s = explode( ",", $row[8] );
            if ( $type == 1 )
            {
                $k6_alarm1 = $s[15];
                $k6_alarm2 = $s[16];
                $k6_alarm3 = $s[17];
            }
            else
            {
                $k6_alarm1 = $s[5];
                $k6_alarm2 = $s[6];
                $k6_alarm3 = $s[7];
            }
            $s = explode( ",", $row[9] );
            if ( $type == 1 )
            {
                $k7_alarm1 = $s[24];
                $k7_alarm2 = $s[25];
                $k7_alarm3 = $s[26];
                $k7_alarm4 = $s[27];
                $k7_alarm5 = $s[28];
                $k7_alarm6 = $s[29];
            }
            else
            {
                $k7_alarm1 = $s[8];
                $k7_alarm2 = $s[9];
                $k7_alarm3 = $s[10];
                $k7_alarm4 = $s[11];
                $k7_alarm5 = $s[12];
                $k7_alarm6 = $s[13];
            }
            $s = explode( ",", $row[10] );
            if ( $type == 1 )
            {
                $k8_alarm1 = $s[27];
                $k8_alarm2 = $s[28];
                $k8_alarm3 = $s[29];
                $k8_alarm4 = $s[30];
                $k8_alarm5 = $s[31];
                $k8_alarm6 = $s[32];
                $k8_alarm7 = $s[33];
            }
            else
            {
                $k8_alarm1 = $s[9];
                $k8_alarm2 = $s[10];
                $k8_alarm3 = $s[11];
                $k8_alarm4 = $s[12];
                $k8_alarm5 = $s[13];
                $k8_alarm6 = $s[14];
                $k8_alarm7 = $s[15];
            }
            $s = explode( ",", $row[11] );
            if ( $type == 1 )
            {
                $k9_alarm1 = $s[18];
                $k9_alarm2 = $s[19];
                $k9_alarm3 = $s[20];
                $k9_alarm4 = $s[21];
            }
            else
            {
                $k9_alarm1 = $s[6];
                $k9_alarm2 = $s[7];
                $k9_alarm3 = $s[8];
                $k9_alarm4 = $s[9];
            }
            $s = explode( ",", $row[12] );
            if ( $type == 1 )
            {
                $k10_alarm1 = $s[18];
                $k10_alarm2 = $s[19];
                $k10_alarm3 = $s[20];
                $k10_alarm4 = $s[21];
            }
            else
            {
                $k10_alarm1 = $s[6];
                $k10_alarm2 = $s[7];
                $k10_alarm3 = $s[8];
                $k10_alarm4 = $s[9];
            }
            $s = explode( ",", $row[13] );
            if ( $type == 1 )
            {
                $k11_alarm1 = $s[9];
            }
            else
            {
                $k11_alarm1 = $s[3];
            }
            $s = explode( ",", $row[14] );
            if ( $type == 1 )
            {
                $k12_alarm1 = $s[9];
            }
            else
            {
                $k12_alarm1 = $s[3];
            }
            $s = explode( ",", $row[15] );
            if ( $type == 1 )
            {
                $k13_alarm1 = $s[9];
            }
            else
            {
                $k13_alarm1 = $s[3];
            }
        }
        else
        {
            exit( );
        }
        $up = $boss;
        $i = $type;
        while ( 0 <= $i )
        {
            $result = mysql_query( "SELECT gRang,gBoss,gName,gLevel,gCredit,gUse,gGame1,gGame3,gGame5,gGame6,gGame7,gGame8,gGame9,gGame10,gGame11,gGame12,gGame13 FROM b_group WHERE gName='{$up}' LIMIT 1", $comm );
            if ( 1 <= mysql_num_rows( $result ) )
            {
                $row = mysql_fetch_row( $result );
                if ( $MaxRang == 0 - 1 || $MaxRang == "@" )
                {
                    $MaxRang = $row[0];
                }
                if ( $row[2] == $boss && 2 <= $type )
                {
                    $ii = $row[4] - $row[5] + $Credit;
                    if ( $ii < $k_credit && $type <= 4 )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "Total Credit Amount:{$k_credit}, cannot be greater than the usable online credit of :{$ii} !!" );
                        }
                        else
                        {
                            echoerror( sprintf( "总信用额度:%d 万,不可大於上线可用额度:%d 万!", $k_credit / 10000, $ii / 10000 ) );
                        }
                    }
                    $s = explode( ",", $row[6] );
                    $MaxWater = $s[0] + 0;
                    if ( $MaxWater < $k_water && substr( $CFG['Check'], 4, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[Baccarat]Rolling:{$k_water} ,cannot be greater than:{$MaxWater} !!" );
                        }
                        else
                        {
                            echoerror( "[百家乐]退水:{$k_water} ,不可大於上线退水:{$MaxWater} !!" );
                        }
                    }
                    $s = explode( ",", $row[7] );
                    $MaxWater3 = $s[0] + 0;
                    if ( $MaxWater3 < $k3_water && substr( $CFG['Check'], 8, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[ChuHan]Rolling:{$k3_water} ,cannot be greater than:{$MaxWater3} !!" );
                        }
                        else
                        {
                            echoerror( "[楚汉]退水:{$k3_water} ,不可大於上线退水:{$MaxWater3} !!" );
                        }
                    }
                    $s = explode( ",", $row[8] );
                    $MaxWater5 = $s[0] + 0;
                    if ( $MaxWater5 < $k5_water && substr( $CFG['Check'], 15, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[Roulette]Rolling:{$k5_water} ,cannot be greater than:{$MaxWater5} !!" );
                        }
                        else
                        {
                            echoerror( "[轮盘]退水:{$k5_water} ,不可大於上线退水:{$MaxWater5} !!" );
                        }
                    }
                    $s = explode( ",", $row[9] );
                    $MaxWater6 = $s[0] + 0;
                    if ( $MaxWater6 < $k6_water && substr( $CFG['Check'], 16, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[Up9]Rolling:{$k6_water} ,cannot be greater than:{$MaxWater6} !!" );
                        }
                        else
                        {
                            echoerror( "[九仔升]退水:{$k6_water} ,不可大於上线退水:{$MaxWater6} !!" );
                        }
                    }
                    $s = explode( ",", $row[10] );
                    $MaxWater7 = $s[0] + 0;
                    $MaxWater7 = $s[0] + 0;
                    if ( $MaxWater7 < $k7_water && substr( $CFG['Check'], 17, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[3Card]Rolling:{$k7_water} ,cannot be greater than:{$MaxWater7} !!" );
                        }
                        else
                        {
                            echoerror( "[三公]退水:{$k7_water} ,不可大於上线退水:{$MaxWater7} !!" );
                        }
                    }
                    $s = explode( ",", $row[11] );
                    $MaxWater8 = $s[0] + 0;
                    if ( $MaxWater8 < $k8_water && substr( $CFG['Check'], 26, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[3Card]Rolling:{$k8_water} ,cannot be greater than:{$MaxWater8} !!" );
                        }
                        else
                        {
                            echoerror( "[骰宝]退水:{$k8_water} ,不可大於上线退水:{$MaxWater8} !!" );
                        }
                    }
                    $s = explode( ",", $row[12] );
                    $MaxWater9 = $s[0] + 0;
                    if ( $MaxWater9 < $k9_water && substr( $CFG['Check'], 28, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[DICE-3]Rolling:{$k9_water} ,cannot be greater than:{$MaxWater9} !!" );
                        }
                        else
                        {
                            echoerror( "[18豆(3)]退水:{$k9_water} ,不可大於上线退水:{$MaxWater9} !!" );
                        }
                    }
                    $s = explode( ",", $row[13] );
                    $MaxWater10 = $s[0] + 0;
                    if ( $MaxWater10 < $k10_water && substr( $CFG['Check'], 29, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[DICE-4]Rolling:{$k10_water} ,cannot be greater than:{$MaxWater10} !!" );
                        }
                        else
                        {
                            echoerror( "[18豆(4)]退水:{$k10_water} ,不可大於上线退水:{$MaxWater10} !!" );
                        }
                    }
                    $s = explode( ",", $row[14] );
                    $MaxWater11 = $s[0] + 0;
                    if ( $MaxWater11 < $k11_water && substr( $CFG['Check'], 34, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[Domino TienGow] Rolling value: {$k11_water}, cannot be greater than {$MaxWater11} !!" );
                        }
                        else
                        {
                            echoerror( "[骨牌天九]退水:{$k11_water} ,不可大於上线退水:{$MaxWater11} !!" );
                        }
                    }
                    $s = explode( ",", $row[15] );
                    $MaxWater12 = $s[0] + 0;
                    if ( $MaxWater12 < $k12_water && substr( $CFG['Check'], 35, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[TienGow] Rolling value: {$k12_water}, cannot be greater than {$MaxWater12} !!" );
                        }
                        else
                        {
                            echoerror( "[天九]退水:{$k12_water} ,不可大於上线退水:{$MaxWater12} !!" );
                        }
                    }
                    $s = explode( ",", $row[16] );
                    $MaxWater13 = $s[0] + 0;
                    if ( $MaxWater13 < $k13_water && substr( $CFG['Check'], 36, 1 ) == "1" )
                    {
                        if ( $Lang == "iso-8859-2" )
                        {
                            echoerror( "[PushTong] Rolling value: {$k13_water}, cannot be greater than {$MaxWater13} !!" );
                        }
                        else
                        {
                            echoerror( "[推筒子]退水:{$k13_water} ,不可大於上线退水:{$MaxWater13} !!" );
                        }
                    }
                }
                $up = $row[1];
                if ( $row[3] == 0 )
                {
                    break;
                }
            }
            --$i;
        }
        if ( $type <= 3 && $MaxRang < $k_rang )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echoerror( "Largest share % rate:".$k_rang."% cannot be bigger than: ".$MaxRang."% !" );
            }
            else
            {
                echoerror( "最大占成数:".$k_rang."% 不可大於上线占成数: ".$MaxRang."% !" );
            }
        }
        if ( $type == 4 )
        {
            $n = $k_rang + $k_rang1;
            if ( $MaxRang < $n )
            {
                if ( $Lang == "iso-8859-2" )
                {
                    echoerror( "Agent+Main Agent share % Rate:".$n."% cannot be greater than: ".$MaxRang."% !" );
                }
                else
                {
                    echoerror( "代理商+总代理占成数:".$n."% 不可大於上线最大占成数: ".$MaxRang."% !" );
                }
            }
            if ( substr( $CFG['Check'], 0, 1 ) != "1" && $n != $MaxRang )
            {
                if ( $Lang == "iso-8859-2" )
                {
                    echoerror( "[Agent+Main Agent] share % rate must be greater than: ".$MaxRang."%" );
                }
                else
                {
                    echoerror( "目前设定[代理商+总代理]占成数必须等於总代理最大占成数: ".$MaxRang."%" );
                }
            }
        }
        if ( $type <= 4 )
        {
            $result = mysql_query( "SELECT gName,gRang,gGame1,gGame3,gLevel,gRang1,gGame5,gGame6,gGame7,gGame8,gGame9,gGame10,gGame11,gGame12,gGame13 FROM b_group WHERE gTree like '%,{$k_name},%' AND gState&16=0 AND gLevel<=5", $comm );
            do
            {
                do
                {
                    if ( !( $row = mysql_fetch_row( $result ) ) )
                    {
                        break;
                    }
                    else
                    {
                        $lev = $row[4];
                    }
                    if ( $lev <= 4 && 0 <= $k_rang )
                    {
                        $rg = $row[1];
                        $rg1 = $row[5];
                        $bUpdate = FALSE;
                        if ( $type == 3 && $lev == 4 && substr( $CFG['Check'], 0, 1 ) != "1" && $rg + $rg1 != $k_rang )
                        {
                            if ( $k_rang < $rg )
                            {
                                $rg = $k_rang;
                                $rg1 = 0;
                            }
                            else
                            {
                                $rg1 = $k_rang - $rg;
                            }
                            $bUpdate = TRUE;
                        }
                        else if ( 0 <= $k_rang && ( $k_rang < $rg || $k_rang < $rg1 ) )
                        {
                            if ( $lev <= 3 && $k_rang < $rg )
                            {
                                $rg = $k_rang;
                            }
                            if ( $lev == 4 )
                            {
                                $dec = $rg - $k_rang;
                                if ( 0 <= $rg1 - $dec )
                                {
                                    $rg1 -= $dec;
                                }
                                else
                                {
                                    $rg1 = 0;
                                    $rg = $k_rang;
                                }
                                if ( $k_rang <= 0 )
                                {
                                    $rg = 0;
                                    $rg1 = 0;
                                }
                            }
                            $bUpdate = TRUE;
                        }
                        if ( $bUpdate == TRUE )
                        {
                            if ( $lev <= 3 )
                            {
                                mysql_query( "Update b_group SET gRang='{$rg}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                            }
                            if ( $lev == 4 )
                            {
                                mysql_query( "Update b_group SET gRang='{$rg}',gRang1='{$rg1}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                            }
                        }
                    }
                    $s = explode( ",", $row[2] );
                    $bUpdate = FALSE;
                    if ( $k_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k_betmode == 1 && $k_minbet + 0 < $s[1] + 0 || $k_betmode == 0 && $s[1] + 0 < $k_minbet + 0 )
                    {
                        $s[1] = $k_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 4, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        $lwSql0 = "Update b_group SET gGame1='{$ss}' WHERE gName='{$row['0']}' LIMIT 1";
                        mysql_query( $lwSql0, $comm );
                    }
                    $s = explode( ",", $row[3] );
                    $bUpdate = FALSE;
                    if ( $k3_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k3_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k3_minbet + 0 < $s[1] + 0 )
                    {
                        $s[1] = $k3_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 8, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame3='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                    $s = explode( ",", $row[6] );
                    $bUpdate = FALSE;
                    if ( $k5_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k5_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k5_betmode == 1 && $k5_minbet + 0 < $s[1] + 0 || $k5_betmode == 0 && $s[1] + 0 < $k5_minbet + 0 )
                    {
                        $s[1] = $k5_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 15, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame5='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                    $s = explode( ",", $row[7] );
                    $bUpdate = FALSE;
                    if ( $k6_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k6_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k6_betmode == 1 && $k6_minbet + 0 < $s[1] + 0 || $k6_betmode == 0 && $s[1] + 0 < $k6_minbet + 0 )
                    {
                        $s[1] = $k6_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 16, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame6='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                    $s = explode( ",", $row[8] );
                    $bUpdate = FALSE;
                    if ( $k7_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k7_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k7_betmode == 1 && $k7_minbet + 0 < $s[1] + 0 || $k7_betmode == 0 && $s[1] + 0 < $k7_minbet + 0 )
                    {
                        $s[1] = $k7_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 17, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame7='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                    $s = explode( ",", $row[9] );
                    $bUpdate = FALSE;
                    if ( $k8_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k8_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k8_betmode == 1 && $k8_minbet + 0 < $s[1] + 0 || $k8_betmode == 0 && $s[1] + 0 < $k8_minbet + 0 )
                    {
                        $s[1] = $k8_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 26, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame8='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                    $s = explode( ",", $row[10] );
                    $bUpdate = FALSE;
                    if ( $k9_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k9_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k9_betmode == 1 && $k9_minbet + 0 < $s[1] + 0 || $k9_betmode == 0 && $s[1] + 0 < $k9_minbet + 0 )
                    {
                        $s[1] = $k9_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 28, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame9='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                    $s = explode( ",", $row[11] );
                    $bUpdate = FALSE;
                    if ( $k10_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k10_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k10_betmode == 1 && $k10_minbet + 0 < $s[1] + 0 || $k10_betmode == 0 && $s[1] + 0 < $k10_minbet + 0 )
                    {
                        $s[1] = $k10_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 29, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame10='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                    $s = explode( ",", $row[12] );
                    $bUpdate = FALSE;
                    if ( $k11_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k11_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k11_betmode == 1 && $k11_minbet + 0 < $s[1] + 0 || $k11_betmode == 0 && $s[1] + 0 < $k11_minbet + 0 )
                    {
                        $s[1] = $k11_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 34, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame11='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                    $s = explode( ",", $row[13] );
                    $bUpdate = FALSE;
                    if ( $k12_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k12_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k12_betmode == 1 && $k12_minbet + 0 < $s[1] + 0 || $k12_betmode == 0 && $s[1] + 0 < $k12_minbet + 0 )
                    {
                        $s[1] = $k12_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 35, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame12='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                    $s = explode( ",", $row[14] );
                    $bUpdate = FALSE;
                    if ( $k13_water + 0 < $s[0] + 0 )
                    {
                        $s[0] = $k13_water + 0;
                        $bUpdate = TRUE;
                    }
                    if ( $k13_betmode == 1 && $k13_minbet + 0 < $s[1] + 0 || $k13_betmode == 0 && $s[1] + 0 < $k13_minbet + 0 )
                    {
                        $s[1] = $k13_minbet;
                        $bUpdate = TRUE;
                    }
                    if ( $bUpdate == TRUE && substr( $CFG['Check'], 36, 1 ) == "1" )
                    {
                        $ss = "";
                        $i = 0;
                        while ( $i < sizeof( $s ) )
                        {
                            if ( 0 < $i )
                            {
                                $ss .= ",";
                            }
                            $ss .= $s[$i];
                            ++$i;
                        }
                        mysql_query( "Update b_group SET gGame13='{$ss}' WHERE gName='{$row['0']}' LIMIT 1", $comm );
                    }
                } while ( 1 );
            } while ( 0 );
        }
        if ( $type <= 4 && 0 < $Use && $k_credit == 0 )
        {
            $result = mysql_query( "SELECT gName FROM b_group WHERE gUse<>gCredit AND gLevel=5 AND gTree like '%,{$k_name},%' LIMIT 1", $comm );
            if ( 1 <= mysql_num_rows( $result ) )
            {
                $row = mysql_fetch_row( $result );
                if ( $Lang == "iso-8859-2" )
                {
                    echoerror( $row[0]." This member has already bet, so cannot reset" );
                }
                else
                {
                    echoerror( $row[0]."这位会员已经下注了,不能归0" );
                }
            }
            $resultD = mysql_query( "SELECT gName FROM b_group WHERE gTree like '%,{$k_name},%'", $comm );
            while ( $rowD = mysql_fetch_row( $resultD ) )
            {
                mysql_query( "Update b_group SET gCredit=0,gUse=0 WHERE gName='{$rowD['0']}' LIMIT 1", $comm );
            }
            mysql_query( "Update b_group SET gCredit='0',gUse=0 WHERE gName='{$k_name}' LIMIT 1", $comm );
            if ( $Lang == "iso-8859-2" )
            {
                mysql_query( "INSERT INTO b_log VALUES ('',2,'".$CFG['Unix']."','".$MyData['MyName']."','{$k_name} ".$typem[$type]." amount reset.','{$UserIP}','')", $comm );
            }
            else
            {
                mysql_query( "INSERT INTO b_log VALUES ('',2,'".$CFG['Unix']."','".$MyData['MyName']."','{$k_name} ".$typem[$type]."及下线额度归零.','{$UserIP}','')", $comm );
            }
        }
        if ( $type <= 4 || substr( $CFG['Check'], 5, 1 ) == "1" )
        {
            $s = ",gCredit={$k_credit}";
        }
        else
        {
            $s = "";
        }
        $game1 = "{$k_water},{$k_minbet},{$k_maxbet1},{$k_maxbet2},{$k_maxbet3}";
        if ( $type != 1 )
        {
            $game1 .= ",{$k_maxbet4}";
        }
        $game3 = "{$k3_water},{$k3_minbet},{$k3_maxbet1},{$k3_maxbet2},{$k3_maxbet3}";
        $game5 = "{$k5_water},{$k5_minbet},{$k5_maxbet1},{$k5_maxbet2},{$k5_maxbet3},{$k5_maxbet4},{$k5_maxbet5},{$k5_maxbet6},{$k5_maxbet7}";
        $game6 = "{$k6_water},{$k6_minbet},{$k6_maxbet1},{$k6_maxbet2},{$k6_maxbet3}";
        $game7 = "{$k7_water},{$k7_minbet},{$k7_maxbet1},{$k7_maxbet2},{$k7_maxbet3},{$k7_maxbet4},{$k7_maxbet5},{$k7_maxbet6}";
        $game8 = "{$k8_water},{$k8_minbet},{$k8_maxbet1},{$k8_maxbet2},{$k8_maxbet3},{$k8_maxbet4},{$k8_maxbet5},{$k8_maxbet6},{$k8_maxbet7}";
        $game9 = "{$k9_water},{$k9_minbet},{$k9_maxbet1},{$k9_maxbet2},{$k9_maxbet3},{$k9_maxbet4}";
        $game10 = "{$k10_water},{$k10_minbet},{$k10_maxbet1},{$k10_maxbet2},{$k10_maxbet3},{$k10_maxbet4}";
        $game11 = "{$k11_water},{$k11_minbet},{$k11_maxbet1}";
        $game12 = "{$k12_water},{$k12_minbet},{$k12_maxbet1}";
        $game13 = "{$k13_water},{$k13_minbet},{$k13_maxbet1}";
        if ( $type <= 1 )
        {
            $k_room = 0;
            if ( substr( $CFG['Check'], 12, 1 ) == "1" )
            {
                $qs = "";
                $i = 20;
                while ( 1 <= $i )
                {
                    $qss = sprintf( "k_ck%02d", $i );
                    $var = $_POST["{$qss}"];
                    if ( $var == 1 )
                    {
                        $qs .= "1";
                    }
                    else
                    {
                        $qs .= "0";
                    }
                    --$i;
                }
                $k_room = bindec( $qs );
            }
            else
            {
                if ( $k_ck01 == 1 )
                {
                    $k_room = $k_room | 1;
                }
                if ( $k_ck02 == 1 )
                {
                    $k_room = $k_room | 2;
                }
                if ( $k_ck03 == 1 )
                {
                    $k_room = $k_room | 4;
                }
            }
            $game1 = $game1.",{$k_limit1},{$k_limit2},{$k_limit3},{$k_room}";
            $k3_room = 0;
            if ( $k3_ck01 == 1 )
            {
                $k3_room = $k3_room | 1;
            }
            if ( $k3_ck02 == 1 )
            {
                $k3_room = $k3_room | 2;
            }
            if ( $k3_ck03 == 1 )
            {
                $k3_room = $k3_room | 4;
            }
            $game3 = $game3.",{$k3_limit1},{$k3_limit2},{$k3_limit3},{$k3_room}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k5_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k5_room = bindec( $qs );
            $game5 = $game5.",{$k5_limit1},{$k5_limit2},{$k5_limit3},{$k5_limit4},{$k5_limit5},{$k5_limit6},{$k5_limit7},{$k5_mag1},{$k5_mag2},{$k5_mag3},{$k5_mag4},{$k5_mag5},{$k5_mag6},{$k5_mag7},{$k5_room},{$k5_betmode}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k6_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k6_room = bindec( $qs );
            $game6 = $game6.",{$k6_limit1},{$k6_limit2},{$k6_limit3},{$k6_mag1},{$k6_mag2},{$k6_mag3},{$k6_room},{$k6_betmode},{$k6_nobet1},{$k6_nobet2}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k7_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k7_room = bindec( $qs );
            $game7 = $game7.",{$k7_limit1},{$k7_limit2},{$k7_limit3},{$k7_limit4},{$k7_limit5},{$k7_limit6},{$k7_mag1},{$k7_mag2},{$k7_mag3},{$k7_mag4},{$k7_mag5},{$k7_mag6},{$k7_room},{$k7_betmode},{$k7_nobet1},{$k7_nobet2}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k8_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k8_room = bindec( $qs );
            $game8 = $game8.",{$k8_limit1},{$k8_limit2},{$k8_limit3},{$k8_limit4},{$k8_limit5},{$k8_limit6},{$k8_limit7},{$k8_mag1},{$k8_mag2},{$k8_mag3},{$k8_mag4},{$k8_mag5},{$k8_mag6},{$k8_mag7},{$k8_room},{$k8_betmode},{$k8_nobet1},{$k8_nobet2}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k9_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k9_room = bindec( $qs );
            $game9 = $game9.",{$k9_limit1},{$k9_limit2},{$k9_limit3},{$k9_limit4},{$k9_mag1},{$k9_mag2},{$k9_mag3},{$k9_mag4},{$k9_room},{$k9_betmode},{$k9_nobet1},{$k9_nobet2}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k10_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k10_room = bindec( $qs );
            $game10 = $game10.",{$k10_limit1},{$k10_limit2},{$k10_limit3},{$k10_limit4},{$k10_mag1},{$k10_mag2},{$k10_mag3},{$k10_mag4},{$k10_room},{$k10_betmode},{$k10_nobet1},{$k10_nobet2}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k11_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k11_room = bindec( $qs );
            $game11 = $game11.",{$k11_limit1},{$k11_mag1},{$k11_room},{$k11_betmode},{$k11_nobet1},{$k11_nobet2}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k12_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k12_room = bindec( $qs );
            $game12 = $game12.",{$k12_limit1},{$k12_mag1},{$k12_room},{$k12_betmode},{$k12_nobet1},{$k12_nobet2}";
            $qs = "";
            $i = 20;
            while ( 1 <= $i )
            {
                $qss = sprintf( "k13_ck%02d", $i );
                $var = $_POST["{$qss}"];
                if ( $var == 1 )
                {
                    $qs .= "1";
                }
                else
                {
                    $qs .= "0";
                }
                --$i;
            }
            $k13_room = bindec( $qs );
            $game13 = $game13.",{$k13_limit1},{$k13_mag1},{$k13_room},{$k13_betmode},{$k13_nobet1},{$k13_nobet2}";
        }
        if ( $type <= 4 )
        {
            $game1 = $game1.",{$k_alarm1},{$k_alarm2},{$k_alarm3}";
            $game3 = $game3.",{$k3_alarm1}";
            $game5 = $game5.",{$k5_alarm1}";
            $game6 = $game6.",{$k6_alarm1},{$k6_alarm2},{$k6_alarm3}";
            $game7 = $game7.",{$k7_alarm1},{$k7_alarm2},{$k7_alarm3},{$k7_alarm4},{$k7_alarm5},{$k7_alarm6}";
            $game8 = $game8.",{$k8_alarm1},{$k8_alarm2},{$k8_alarm3},{$k8_alarm4},{$k8_alarm5},{$k8_alarm6},{$k8_alarm7}";
            $game9 = $game9.",{$k9_alarm1},{$k9_alarm2},{$k9_alarm3},{$k9_alarm4}";
            $game10 = $game10.",{$k10_alarm1},{$k10_alarm2},{$k10_alarm3},{$k10_alarm4}";
            $game11 = $game11.",{$k11_alarm1}";
            $game12 = $game12.",{$k12_alarm1}";
            $game13 = $game13.",{$k13_alarm1}";
            if ( $type == 1 )
            {
                $game1 = $game1.",{$k_betmode},{$k_mag1},{$k_mag2},{$k_mag3},{$k_nobet1},{$k_nobet2},{$k_nobet3},{$k_nobet4},{$k_nobet5},{$k_maxbet4},{$k_limit4},{$k_mag4}";
            }
        }
        $game = "";
        if ( substr( $CFG['Check'], 4, 1 ) == "1" )
        {
            $game = ",gGame1='{$game1}'";
        }
        if ( substr( $CFG['Check'], 8, 1 ) == "1" )
        {
            $game .= ",gGame3='{$game3}'";
        }
        if ( substr( $CFG['Check'], 15, 1 ) == "1" )
        {
            $game .= ",gGame5='{$game5}'";
        }
        if ( substr( $CFG['Check'], 16, 1 ) == "1" )
        {
            $game .= ",gGame6='{$game6}'";
        }
        if ( substr( $CFG['Check'], 17, 1 ) == "1" )
        {
            $game .= ",gGame7='{$game7}'";
        }
        if ( substr( $CFG['Check'], 26, 1 ) == "1" )
        {
            $game .= ",gGame8='{$game8}'";
        }
        if ( substr( $CFG['Check'], 28, 1 ) == "1" )
        {
            $game .= ",gGame9='{$game9}'";
        }
        if ( substr( $CFG['Check'], 29, 1 ) == "1" )
        {
            $game .= ",gGame10='{$game10}'";
        }
        if ( substr( $CFG['Check'], 34, 1 ) == "1" )
        {
            $game .= ",gGame11='{$game11}'";
        }
        if ( substr( $CFG['Check'], 35, 1 ) == "1" )
        {
            $game .= ",gGame12='{$game12}'";
        }
        if ( substr( $CFG['Check'], 36, 1 ) == "1" )
        {
            $game .= ",gGame13='{$game13}'";
        }
        if ( $type <= 1 )
        {
            $game .= ",gGid='{$k_unit}'";
        }
        if ( $type <= 4 )
        {
            $lwsql = "Update b_group SET gNike='{$k_cname}',gPass='{$k_passwd}'{$s},gState={$state},gRang='{$k_rang}',gRang1='{$k_rang1}'{$game} WHERE gName='{$k_name}' LIMIT 1";
            mysql_query( $lwsql, $comm );
        }
        else
        {
            $lwsql = "Update b_group SET gNike='{$k_cname}',gPass='{$k_passwd}'{$s},gState={$state},gData='{$k_data}'{$game} WHERE gName='{$k_name}' LIMIT 1";
            mysql_query( $lwsql, $comm );
        }
        mysql_query( "INSERT INTO b_log VALUES ('',3,'".$CFG['Unix']."','".$MyData['MyName']."','".$typem[$MyData['Level']]."修改".$typem[$type].":{$k_name} 的资料','{$UserIP}','{$tree}')", $comm );
        if ( $Credit != $k_credit && $type <= 4 )
        {
            if ( 2 <= $type )
            {
                adjcredit( $boss );
            }
            mysql_query( "INSERT INTO b_log VALUES ('',2,'".$CFG['Unix']."','".$MyData['MyName']."','{$k_name} 额度:{$Credit} 调整:{$k_credit}','{$UserIP}','{$MyTree}')", $comm );
        }
        if ( $k_mode == "66" )
        {
            $resultD = mysql_query( "SELECT gName,gLevel,gGame1,gGame3,gGame5,gGame6,gGame7,gGame8,gGame9,gGame10,gGame11,gGame12,gGame13 FROM b_group WHERE gState&16=0 AND gLevel>=2 AND gTree like '%,{$k_name},%'", $comm );
            do
            {
                do
                {
                    if ( !( $rowD = mysql_fetch_row( $resultD ) ) )
                    {
                        break;
                    }
                    else
                    {
                        $s1 = explode( ",", $rowD[2] );
                    }
                    if ( 0 < $k_mag1 )
                    {
                        $b1 = $k_minbet * $k_mag1;
                    }
                    else
                    {
                        $b1 = $k_maxbet1;
                    }
                    if ( 0 < $k_mag2 )
                    {
                        $b2 = $k_minbet * $k_mag2;
                    }
                    else
                    {
                        $b2 = $k_maxbet2;
                    }
                    if ( 0 < $k_mag3 )
                    {
                        $b3 = $k_minbet * $k_mag3;
                    }
                    else
                    {
                        $b3 = $k_maxbet3;
                    }
                    if ( 0 < $k_mag4 )
                    {
                        $b4 = $k_minbet * $k_mag4;
                    }
                    else
                    {
                        $b4 = $k_maxbet4;
                    }
                    $game1 = $s1[0].",{$k_minbet},{$b1},{$b2},{$b3},{$b4}";
                    $s3 = explode( ",", $rowD[3] );
                    $game3 = $s3[0].",{$k3_minbet},{$k3_maxbet1},{$k3_maxbet2},{$k3_maxbet3}";
                    $s5 = explode( ",", $rowD[4] );
                    if ( 0 < $k5_mag1 )
                    {
                        $b1 = $k5_minbet * $k5_mag1;
                    }
                    else
                    {
                        $b1 = $k5_maxbet1;
                    }
                    if ( 0 < $k5_mag2 )
                    {
                        $b2 = $k5_minbet * $k5_mag2;
                    }
                    else
                    {
                        $b2 = $k5_maxbet2;
                    }
                    if ( 0 < $k5_mag3 )
                    {
                        $b3 = $k5_minbet * $k5_mag3;
                    }
                    else
                    {
                        $b3 = $k5_maxbet3;
                    }
                    if ( 0 < $k5_mag4 )
                    {
                        $b4 = $k5_minbet * $k5_mag4;
                    }
                    else
                    {
                        $b4 = $k5_maxbet4;
                    }
                    if ( 0 < $k5_mag5 )
                    {
                        $b5 = $k5_minbet * $k5_mag5;
                    }
                    else
                    {
                        $b5 = $k5_maxbet5;
                    }
                    if ( 0 < $k5_mag6 )
                    {
                        $b6 = $k5_minbet * $k5_mag6;
                    }
                    else
                    {
                        $b6 = $k5_maxbet6;
                    }
                    if ( 0 < $k5_mag7 )
                    {
                        $b7 = $k5_minbet * $k5_mag7;
                    }
                    else
                    {
                        $b7 = $k5_maxbet7;
                    }
                    $game5 = $s5[0].",{$k5_minbet},{$b1},{$b2},{$b3},{$b4},{$b5},{$b6},{$b7}";
                    $s6 = explode( ",", $rowD[5] );
                    if ( 0 < $k6_mag1 )
                    {
                        $b1 = $k6_minbet * $k6_mag1;
                    }
                    else
                    {
                        $b1 = $k6_maxbet1;
                    }
                    if ( 0 < $k6_mag2 )
                    {
                        $b2 = $k6_minbet * $k6_mag2;
                    }
                    else
                    {
                        $b2 = $k6_maxbet2;
                    }
                    if ( 0 < $k6_mag3 )
                    {
                        $b3 = $k6_minbet * $k6_mag3;
                    }
                    else
                    {
                        $b3 = $k6_maxbet3;
                    }
                    $game6 = $s6[0].",{$k6_minbet},{$b1},{$b2},{$b3}";
                    $s7 = explode( ",", $rowD[6] );
                    if ( 0 < $k7_mag1 )
                    {
                        $b1 = $k7_minbet * $k7_mag1;
                    }
                    else
                    {
                        $b1 = $k7_maxbet1;
                    }
                    if ( 0 < $k7_mag2 )
                    {
                        $b2 = $k7_minbet * $k7_mag2;
                    }
                    else
                    {
                        $b2 = $k7_maxbet2;
                    }
                    if ( 0 < $k7_mag3 )
                    {
                        $b3 = $k7_minbet * $k7_mag3;
                    }
                    else
                    {
                        $b3 = $k7_maxbet3;
                    }
                    if ( 0 < $k7_mag4 )
                    {
                        $b4 = $k7_minbet * $k7_mag4;
                    }
                    else
                    {
                        $b4 = $k7_maxbet4;
                    }
                    if ( 0 < $k7_mag5 )
                    {
                        $b5 = $k7_minbet * $k7_mag5;
                    }
                    else
                    {
                        $b5 = $k7_maxbet5;
                    }
                    if ( 0 < $k7_mag6 )
                    {
                        $b6 = $k7_minbet * $k7_mag6;
                    }
                    else
                    {
                        $b6 = $k7_maxbet6;
                    }
                    $game7 = $s7[0].",{$k7_minbet},{$b1},{$b2},{$b3},{$b4},{$b5},{$b6}";
                    $s8 = explode( ",", $rowD[7] );
                    if ( 0 < $k8_mag1 )
                    {
                        $b1 = $k8_minbet * $k8_mag1;
                    }
                    else
                    {
                        $b1 = $k8_maxbet1;
                    }
                    if ( 0 < $k8_mag2 )
                    {
                        $b2 = $k8_minbet * $k8_mag2;
                    }
                    else
                    {
                        $b2 = $k8_maxbet2;
                    }
                    if ( 0 < $k8_mag3 )
                    {
                        $b3 = $k8_minbet * $k8_mag3;
                    }
                    else
                    {
                        $b3 = $k8_maxbet3;
                    }
                    if ( 0 < $k8_mag4 )
                    {
                        $b4 = $k8_minbet * $k8_mag4;
                    }
                    else
                    {
                        $b4 = $k8_maxbet4;
                    }
                    if ( 0 < $k8_mag5 )
                    {
                        $b5 = $k8_minbet * $k8_mag5;
                    }
                    else
                    {
                        $b5 = $k8_maxbet5;
                    }
                    if ( 0 < $k8_mag6 )
                    {
                        $b6 = $k8_minbet * $k8_mag6;
                    }
                    else
                    {
                        $b6 = $k8_maxbet6;
                    }
                    if ( 0 < $k8_mag7 )
                    {
                        $b7 = $k8_minbet * $k8_mag7;
                    }
                    else
                    {
                        $b7 = $k8_maxbet7;
                    }
                    $game8 = $s8[0].",{$k8_minbet},{$b1},{$b2},{$b3},{$b4},{$b5},{$b6},{$b7}";
                    $s9 = explode( ",", $rowD[8] );
                    if ( 0 < $k9_mag1 )
                    {
                        $b1 = $k9_minbet * $k9_mag1;
                    }
                    else
                    {
                        $b1 = $k9_maxbet1;
                    }
                    if ( 0 < $k9_mag2 )
                    {
                        $b2 = $k9_minbet * $k9_mag2;
                    }
                    else
                    {
                        $b2 = $k9_maxbet2;
                    }
                    if ( 0 < $k9_mag3 )
                    {
                        $b3 = $k9_minbet * $k9_mag3;
                    }
                    else
                    {
                        $b3 = $k9_maxbet3;
                    }
                    if ( 0 < $k9_mag4 )
                    {
                        $b4 = $k9_minbet * $k9_mag4;
                    }
                    else
                    {
                        $b4 = $k9_maxbet4;
                    }
                    $game9 = $s9[0].",{$k9_minbet},{$b1},{$b2},{$b3},{$b4}";
                    $s10 = explode( ",", $rowD[9] );
                    if ( 0 < $k10_mag1 )
                    {
                        $b1 = $k10_minbet * $k10_mag1;
                    }
                    else
                    {
                        $b1 = $k10_maxbet1;
                    }
                    if ( 0 < $k10_mag2 )
                    {
                        $b2 = $k10_minbet * $k10_mag2;
                    }
                    else
                    {
                        $b2 = $k10_maxbet2;
                    }
                    if ( 0 < $k10_mag3 )
                    {
                        $b3 = $k10_minbet * $k10_mag3;
                    }
                    else
                    {
                        $b3 = $k10_maxbet3;
                    }
                    if ( 0 < $k10_mag4 )
                    {
                        $b4 = $k10_minbet * $k10_mag4;
                    }
                    else
                    {
                        $b4 = $k10_maxbet4;
                    }
                    $game10 = $s10[0].",{$k10_minbet},{$b1},{$b2},{$b3},{$b4}";
                    $s11 = explode( ",", $rowD[10] );
                    if ( 0 < $k11_mag1 )
                    {
                        $b1 = $k11_minbet * $k11_mag1;
                    }
                    else
                    {
                        $b1 = $k11_maxbet1;
                    }
                    $game11 = $s11[0].",{$k11_minbet},{$b1}";
                    $s12 = explode( ",", $rowD[11] );
                    if ( 0 < $k12_mag1 )
                    {
                        $b1 = $k12_minbet * $k12_mag1;
                    }
                    else
                    {
                        $b1 = $k12_maxbet1;
                    }
                    $game12 = $s12[0].",{$k12_minbet},{$b1}";
                    $s13 = explode( ",", $rowD[12] );
                    if ( 0 < $k13_mag1 )
                    {
                        $b1 = $k13_minbet * $k13_mag1;
                    }
                    else
                    {
                        $b1 = $k13_maxbet1;
                    }
                    $game13 = $s13[0].",{$k13_minbet},{$b1}";
                    if ( $rowD[1] <= 4 )
                    {
                        $k_alarm1 = $s1[6];
                        $k_alarm2 = $s1[7];
                        $k_alarm3 = $s1[8];
                        $k_alarm4 = $s1[9];
                        $k3_alarm1 = $s3[5];
                        $k5_alarm1 = $s5[9];
                        $k6_alarm1 = $s6[5];
                        $k6_alarm2 = $s6[6];
                        $k6_alarm2 = $s6[7];
                        $k7_alarm1 = $s7[8];
                        $k7_alarm2 = $s7[9];
                        $k7_alarm3 = $s7[10];
                        $k7_alarm4 = $s7[11];
                        $k7_alarm5 = $s7[12];
                        $k8_alarm1 = $s8[9];
                        $k8_alarm2 = $s8[10];
                        $k8_alarm3 = $s8[11];
                        $k8_alarm4 = $s8[12];
                        $k8_alarm5 = $s8[13];
                        $k8_alarm6 = $s8[14];
                        $k8_alarm7 = $s8[15];
                        $k9_alarm1 = $s9[6];
                        $k9_alarm2 = $s9[7];
                        $k9_alarm3 = $s9[8];
                        $k9_alarm4 = $s9[9];
                        $k10_alarm1 = $s10[6];
                        $k10_alarm2 = $s10[7];
                        $k10_alarm3 = $s10[8];
                        $k10_alarm4 = $s10[9];
                        $k11_alarm1 = $s11[3];
                        $k12_alarm1 = $s12[3];
                        $k13_alarm1 = $s13[3];
                        $game1 = $s1[0].",{$k_minbet},{$k_maxbet1},{$k_maxbet2},{$k_maxbet3},{$k_maxbet4},{$k_alarm1},{$k_alarm2},{$k_alarm3},{$k_alarm4}";
                        $game3 = $s3[0].",{$k3_minbet},{$k3_maxbet1},{$k3_maxbet2},{$k3_maxbet3},{$k3_alarm1}";
                        $game5 = $s5[0].",{$k5_minbet},{$k5_maxbet1},{$k5_maxbet2},{$k5_maxbet3},{$k5_maxbet4},{$k5_maxbet5},{$k5_maxbet6},{$k5_maxbet7},{$k5_alarm1}";
                        $game6 = $s6[0].",{$k6_minbet},{$k6_maxbet1},{$k6_maxbet2},{$k6_maxbet3},{$k6_alarm1},{$k6_alarm2},{$k6_alarm3}";
                        $game7 = $s7[0].",{$k7_minbet},{$k7_maxbet1},{$k7_maxbet2},{$k7_maxbet3},{$k7_maxbet4},{$k7_maxbet5},{$k7_maxbet6},{$k7_alarm1},{$k7_alarm2},{$k7_alarm3},{$k7_alarm4},{$k7_alarm5},{$k7_alarm6}";
                        $game8 = $s8[0].",{$k8_minbet},{$k8_maxbet1},{$k8_maxbet2},{$k8_maxbet3},{$k8_maxbet4},{$k8_maxbet5},{$k8_maxbet6},{$k8_maxbet7},{$k8_alarm1},{$k8_alarm2},{$k8_alarm3},{$k8_alarm4},{$k8_alarm5},{$k8_alarm6},{$k8_alarm7}";
                        $game9 = $s9[0].",{$k9_minbet},{$k9_maxbet1},{$k9_maxbet2},{$k9_maxbet3},{$k9_maxbet4},{$k9_alarm1},{$k9_alarm2},{$k9_alarm3},{$k9_alarm4}";
                        $game10 = $s10[0].",{$k10_minbet},{$k10_maxbet1},{$k10_maxbet2},{$k10_maxbet3},{$k10_maxbet4},{$k10_alarm1},{$k10_alarm2},{$k10_alarm3},{$k10_alarm4}";
                        $game11 = $s11[0].",{$k11_minbet},{$k11_maxbet1},{$k11_alarm1}";
                        $game12 = $s12[0].",{$k12_minbet},{$k12_maxbet1},{$k12_alarm1}";
                        $game13 = $s13[0].",{$k13_minbet},{$k13_maxbet1},{$k13_alarm1}";
                    }
                    $game = "";
                    if ( substr( $CFG['Check'], 4, 1 ) == "1" )
                    {
                        $game = "gGame1='{$game1}'";
                    }
                    if ( substr( $CFG['Check'], 8, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame3='{$game3}'";
                    }
                    if ( substr( $CFG['Check'], 15, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame5='{$game5}'";
                    }
                    if ( substr( $CFG['Check'], 16, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame6='{$game6}'";
                    }
                    if ( substr( $CFG['Check'], 17, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame7='{$game7}'";
                    }
                    if ( substr( $CFG['Check'], 26, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame8='{$game8}'";
                    }
                    if ( substr( $CFG['Check'], 28, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame9='{$game9}'";
                    }
                    if ( substr( $CFG['Check'], 29, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame10='{$game10}'";
                    }
                    if ( substr( $CFG['Check'], 34, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame11='{$game11}'";
                    }
                    if ( substr( $CFG['Check'], 35, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame12='{$game12}'";
                    }
                    if ( substr( $CFG['Check'], 36, 1 ) == "1" )
                    {
                        if ( $game != "" )
                        {
                            $game .= ",";
                        }
                        $game .= "gGame13='{$game13}'";
                    }
                    if ( $game != "" )
                    {
                        mysql_query( "Update b_group SET {$game} WHERE gName='{$rowD['0']}' LIMIT 1", $comm );
                    }
                } while ( 1 );
            } while ( 0 );
        }
    }
}
$bs = "";
$tr = "";
if ( $enable == "Y" )
{
    $en = "AND gState&1=0";
}
else if ( $enable == "N" )
{
    $en = "AND gState&1";
}
else
{
    $en = "";
}
if ( $sort == 0 )
{
    $st = "ORDER BY gDateC";
}
else if ( $sort == 1 )
{
    $st = "ORDER BY gNike";
}
else if ( $sort == 2 )
{
    $st = "ORDER BY gName";
}
else if ( $sort == 3 )
{
    $st = "ORDER BY gIp";
}
else if ( $sort == 4 )
{
    $st = "ORDER BY gDateB";
}
if ( $order == 1 )
{
    $st = $st." DESC";
}
$gcount = 0;
if ( 1 < $type )
{
    $i = $type - 1;
    if ( 0 < $MyData['Level'] )
    {
        $tr = "AND gTree like '%,".$MyData['Name'].",%'";
    }
    $result = mysql_query( "SELECT gName,gTree,gNike FROM b_group WHERE gState&16=0 AND gLevel={$i} {$tr} ORDER BY gTree", $comm );
    while ( $row = mysql_fetch_row( $result ) )
    {
        if ( $boss == "" && $gcount == 0 )
        {
            $boss = $row[0];
        }
        $gname[$gcount] = $row[0];
        if ( 1 < $i )
        {
            $row[1] = ereg_replace( ",", "->", substr( $row[1], 1, 80 ) );
            $gstr[$gcount] = $row[1].$row[0]." ({$row['2']})";
        }
        else
        {
            $gstr[$gcount] = $row[0]." ({$row['2']})";
        }
        ++$gcount;
    }
    $bs = " AND gBoss='{$boss}'";
}
if ( 0 < $MyData['Level'] && $MyData['Level'] + 1 == $type )
{
    $bs = " AND gBoss='".$MyData['Name']."'";
}
$result = mysql_query( "SELECT gNike,gName,gCredit,gDateL,gDateC,gState,gIp,gRang,gDateB,gUse,gCount,gRang1,gBet,gBetWin,gRebate,gGame1,gGame2,gGame3,gGid,gGame5,gPass,gGame6,gGame7,gIn,gOut,gGame8,gGame9,gGame10,gGame11,gGame12,gGame13 FROM b_group WHERE gState&16=0 AND gLevel={$type} {$en}{$bs} {$st}", $comm );
$rown = mysql_num_rows( $result );
$TotalPage = $rown / $CFG_Row;
if ( $rown % $CFG_Row != 0 )
{
    ++$TotalPage;
}
if ( strlen( $k_f ) == 8 && 1 < $TotalPage )
{
    $ii = 0;
    while ( $ii < $TotalPage )
    {
        $test = FALSE;
        $start_no = $ii * $CFG_Row;
        if ( $rown <= $start_no && 1 <= $ii )
        {
            $start_no = ( $ii - 1 ) * $CFG_Row;
        }
        $end_no = $start_no + $CFG_Row;
        if ( $rown < $end_no )
        {
            $end_no = $rown;
        }
        $i = $start_no;
        while ( $i < $end_no )
        {
            @mysql_data_seek( @$result, @$i );
            $row = mysql_fetch_row( $result );
            if ( $row[1] == $k_f )
            {
                $page = $ii;
                $test = TRUE;
                break;
            }
            ++$i;
        }
        if ( $test == TRUE )
        {
            break;
        }
        ++$ii;
    }
}
if ( $boss == "" )
{
    $boss = $MyData['Name'];
}
if ( substr( $CFG['Check'], 5, 1 ) == "1" )
{
    if ( $Lang == "iso-8859-2" )
    {
        $betstr = "Total Bet";
    }
    else
    {
        $betstr = "总押分";
    }
}
else if ( $Lang == "iso-8859-2" )
{
    $betstr = "Total Bet";
}
else
{
    $betstr = "总投";
}
echo "<html>\r\n<head>\r\n<title></title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=";
echo $Lang;
echo "\">\r\n<LINK href=\"control_main.css\" type=text/css rel=stylesheet>\r\n";
echo "<s";
echo "cript Language='JavaScript'>\r\n";
if ( $message != "" )
{
    echo "alert('{$message}');\n";
}
if ( $gcount == 0 && 2 <= $type && $MyData['Level'] + 1 != $type )
{
    if ( $Lang == "iso-8859-2" )
    {
        echo "alert('Please first setup ".$typem[$type - 1]." information!!');\n";
    }
    else
    {
        echo "alert('请先建 ".$typem[$type - 1]." 资料!!');\n";
    }
    echo "history.back();\n";
    echo "</script>\n";
    exit( );
}
echo "parent.TopFrame.SS_set(7,{$type});\n";
echo "function SS_Check(mode,name)\r\n {\r\n  if(mode=='1' && !confirm(\"";
if ( $Lang == "iso-8859-2" )
{
    echo "Are you sure you want to stop the usage of";
}
else
{
    echo big52gb( "是否确定停用" );
}
echo " \"+name+\" ?\"))return;\r\n  if(mode=='2' && !confirm(\"";
if ( $Lang == "iso-8859-2" )
{
    echo "Are you sure you want to start the usage of";
}
else
{
    echo big52gb( "是否确定启用" );
}
echo " \"+name+\" ?\"))return;\r\n  if(mode=='3' && !confirm(\"";
if ( $Lang == "iso-8859-2" )
{
    echo "Are you sure you want to delete";
}
else
{
    echo big52gb( "是否确定删除" );
}
echo " \"+name+\" ? \\n\\n";
if ( $Lang == "iso-8859-2" )
{
    echo "Warning: You cannot undo this delete once it is done!";
}
else
{
    echo big52gb( "警告:一经删除将无法复原" );
}
echo ".\"))return;\r\n  document.group.k_mode.value=mode;\r\n  document.group.k_name.value=name;\r\n  document.group.submit();\r\n }\r\nfunction SS_ChgPwd(name)\r\n {\r\n  window.open('chg_passwd3.php";
echo "?uid={$uid}&Lang={$Lang}&name=";
echo "'+name,'Chg_pass3','width=255,height=169,status=no');\r\n }\r\nfunction SS_Accs(name)\r\n {\r\n  if(!confirm(\"";
if ( $Lang == "iso-8859-2" )
{
    echo "Are you sure you want to settle all the members accounts of ";
}
else
{
    echo big52gb( "是否确定结算" );
}
echo " \"+name+\"";
if ( $type <= 4 )
{
    if ( $Lang == "iso-8859-2" )
    {
        echo "";
    }
    else
    {
        echo big52gb( "所有会员" );
    }
}
echo "?\\n\\n";
if ( $Lang == "iso-8859-2" )
{
    echo "Note: Settling the accounts will reset the used credit back to the full amount.";
}
else if ( substr( $CFG['Check'], 20, 1 ) == "1" )
{
    if ( substr( $CFG['Check'], 31, 1 ) != "1" )
    {
        echo big52gb( "注:结算会做以下动作\\n1.将会员目前余额归零\\n2.将交易帐转为已结算\\n3.归还上线己占额度" );
    }
    else
    {
        echo big52gb( "注:结算会将交易帐转为已结算" );
    }
}
else
{
    echo big52gb( "注:结算会将会员已用点数归还,并将未结算帐表转为结算帐" );
}
echo ".\"))return;\r\n  document.group.k_mode.value='ACCS';\r\n  if(name=='')name='ALLUSERS';\r\n  document.group.k_name.value=name;\r\n  document.group.submit();\r\n }\r\nfunction SS_Roll(name,roll)\r\n {\r\n  ";
if ( $type == 5 )
{
    echo "  if(roll<=0){alert(\"";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Rolling is ZERO..";
    }
    else
    {
        echo big52gb( "退水额为0,没有入余额的必要" );
    }
    echo "\");return;}\r\n  if(!confirm(\"";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Are you sure?\\n\\nRolling:";
    }
    else
    {
        echo big52gb( "是否确定退水入余额?\\n\\n退水:" );
    }
    echo "\"+roll))return;\r\n  ";
}
else
{
    echo "  if(!confirm(\"";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Are you sure?";
    }
    else
    {
        echo big52gb( "是否确定将所有下线的退水入余额?\\n\\n" );
    }
    echo "\"))return;\r\n  ";
}
echo "  document.group.k_mode.value='ROLL';\r\n  if(name=='')name='ALLUSERS';\r\n  document.group.k_name.value=name;\r\n  document.group.submit();\r\n }\r\nfunction SS_Score(name,mode,credit)\r\n {\r\n  if(mode=='DOWN')\r\n   {\r\n\t";
if ( substr( $CFG['Check'], 20, 1 ) == "2" )
{
    echo "\tif(!confirm(\"";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Are you sure?";
    }
    else
    {
        echo big52gb( "是否确定洗分?" );
    }
    echo "\"))return;\r\n\tstr='0';\r\n\t";
}
else
{
    echo "\tstr=prompt(\"";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Please enter amount";
    }
    else
    {
        echo big52gb( "请输入洗分点数:" );
    }
    echo "\",credit); \r\n\t";
}
echo "   }\r\n   else if(mode=='UP' || mode=='UPD')str=prompt(\"";
if ( $Lang == "iso-8859-2" )
{
    echo "Please enter amount";
}
else
{
    echo big52gb( "请输入上分点数:" );
}
echo "\",\"\");\r\n    else return;\r\n  if(str!=null && str>0)\r\n   {\r\n    document.group.k_mode.value=mode;\r\n    document.group.k_name.value=name;\r\n\tdocument.group.k_ud.value=str;\r\n\tdocument.group.submit();\r\n   }\r\n }\r\nfunction SS_Edit(name,mode)\r\n {\r\n  document.location='group_add.php?k_name='+name+'";
echo "&uid={$uid}&Lang={$Lang}&type={$type}&page={$page}&sort={$sort}&order={$order}&enabled={$enabled}&boss={$boss}";
echo "';\r\n }\r\nfunction SS_Go(name)\r\n {\r\n  document.location='group.php?boss='+name+'";
$i = $type + 1;
echo "&uid={$uid}&Lang={$Lang}&type={$i}&enable={$enable}&sort={$sort}&order={$order}";
echo "';\r\n }\r\nfunction SS_lock(name,mode) \r\n {\r\n  document.group.k_mode.value=mode;\r\n  document.group.k_name.value=name;\r\n  document.group.submit();\r\n } \r\nfunction SS_Found()\r\n {\r\n  str=prompt(\"";
if ( $Lang == "iso-8859-2" )
{
    echo "Please enter acc no (or name).";
}
else
{
    echo big52gb( "请输入要寻找的帐号(或名称)" );
}
echo ":\",\"";
echo $k_f;
echo "\");\r\n  if(str!=null)\r\n   {\r\n    document.group.k_f.value=str;\r\n\tdocument.group.submit();\r\n   }\r\n }\r\nfunction SS_tick(name)\r\n {\r\n  window.open('";
echo "report_tick.php?uid={$uid}&Lang={$Lang}&pay_type=0&mode=99&name=";
echo "'+name,'report_tick','width=1024,height=668,left=0,top=0,scrollbars=yes,resizable=yes'); \r\n }\r\nfunction SS_ResetCoin(name)\r\n {\r\n  if(!confirm(\"";
if ( $Lang == "iso-8859-2" )
{
    echo "Are you sure?";
}
else
{
    echo big52gb( "是否确定归零?" );
}
echo "\"))return;\r\n  document.group.k_mode.value=\"RESETCOIN\";\r\n  document.group.k_name.value=name;\r\n  document.group.submit();\r\n }\r\n";
if ( $type == 5 && $MyData['Level'] <= 4 && substr( $CFG['Check'], 20, 1 ) == "1" )
{
    echo "function SS_Chip(no,pw)\r\n {\r\n  parent.TopFrame.SS_write(no,pw);\r\n }\r\n";
}
echo "</script>\r\n</head>\r\n<body";
echo $CFG_Body;
echo " bgcolor=\"#FFFFFF\" text=\"#000000\" leftmargin=\"0\" topmargin=\"0\" vlink=\"#0000FF\" alink=\"#0000FF\">\r\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n<tr><td>\r\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n  <form name=\"group\" action=\"group.php?";
echo "uid={$uid}&Lang={$Lang}&type={$type}";
echo "\" method=POST>\r\n    <TR> \r\n      <TD height=1 class=\"ag_index_ctrl_line\"></TD>\r\n    </TR>\r\n    <tr> \r\n      <td class=\"ag_index_ctrl_bg\" valign=\"middle\"> ";
echo $typem[$type];
if ( $Lang == "iso-8859-2" )
{
    echo " Admin";
}
else
{
    echo big52gb( "管理" );
}
echo ": \r\n        ";
echo "<s";
echo "elect name=\"enable\" class=za_select onChange=\"self.group.submit()\">\r\n          <option value=\"Y\" ";
if ( $enable == "Y" )
{
    echo "selected";
}
echo "> ";
if ( $Lang == "iso-8859-2" )
{
    echo "In Use";
}
else
{
    echo big52gb( "启用" );
}
echo " </option>\r\n          <option value=\"N\" ";
if ( $enable == "N" )
{
    echo "selected";
}
echo "> ";
if ( $Lang == "iso-8859-2" )
{
    echo "Stopped";
}
else
{
    echo big52gb( "停用" );
}
echo " </option>\r\n          <option value=\"A\" ";
if ( $enable == "A" )
{
    echo "selected";
}
echo "> ";
if ( $Lang == "iso-8859-2" )
{
    echo "Both";
}
else
{
    echo big52gb( "全部" );
}
echo " </option>\r\n        </select> ";
if ( $Lang == "iso-8859-2" )
{
    echo "Sort";
}
else
{
    echo big52gb( "排序" );
}
echo " \r\n        ";
echo "<s";
echo "elect name=\"sort\" class=za_select onChange=\"self.group.submit()\">\r\n          <option value=\"0\" ";
if ( $sort <= 0 )
{
    echo "selected";
}
echo "> ";
if ( $Lang == "iso-8859-2" )
{
    echo "Date";
}
else
{
    echo big52gb( "日期" );
}
echo " </option>\t\t  \r\n          <option value=\"1\" ";
if ( $sort == 1 )
{
    echo "selected";
}
echo "> ";
if ( $Lang == "iso-8859-2" )
{
    echo "Name";
}
else
{
    echo big52gb( "名称" );
}
echo " </option>\r\n          <option value=\"2\" ";
if ( $sort == 2 )
{
    echo "selected";
}
echo "> ";
if ( $Lang == "iso-8859-2" )
{
    echo "Acc No.";
}
else
{
    echo big52gb( "帐号" );
}
echo " </option>\r\n\t\t  <option value=\"3\" ";
if ( $sort == 3 )
{
    echo "selected";
}
echo "> IP </option>\r\n";
if ( $type == 5 )
{
    echo "<option value=\"4\" ";
    if ( $sort == 4 )
    {
        echo "selected";
    }
    echo "> ";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Bets";
    }
    else
    {
        echo big52gb( "下注" );
    }
    echo " </option>";
}
echo "        </select>\r\n        ";
echo "<s";
echo "elect name=\"order\" class=za_select onChange=\"self.group.submit()\">\r\n          <option value=\"0\" ";
if ( $order <= 0 )
{
    echo "selected";
}
echo "> ";
if ( $Lang == "iso-8859-2" )
{
    echo "Small to Big";
}
else
{
    echo big52gb( "小到大" );
}
echo " </option>\r\n          <option value=\"1\" ";
if ( $order == 1 )
{
    echo "selected";
}
echo "> ";
if ( $Lang == "iso-8859-2" )
{
    echo "Big to Small";
}
else
{
    echo big52gb( "大到小" );
}
echo " </option>\r\n        </select> -- ";
if ( $Lang == "iso-8859-2" )
{
    echo "Page";
}
else
{
    echo big52gb( "总页数" );
}
echo ": \r\n        ";
echo "<s";
echo "elect name=\"page\" class=za_select onChange=\"self.group.submit()\">\r\n          ";
$i = 0;
while ( $i < $TotalPage )
{
    $ii = $i + 1;
    if ( $page == $i )
    {
        echo "<option value={$i} selected>{$ii}</option>";
    }
    else
    {
        echo "<option value={$i}>{$ii}</option>";
    }
    ++$i;
}
echo "        </select>\r\n        / \r\n        ";
echo $TotalPage;
echo "        ";
if ( $Lang != "iso-8859-2" )
{
    echo big52gb( "页 --" );
}
if ( 1 < $type && $MyData['Level'] + 1 != $type )
{
    if ( $Lang == "iso-8859-2" )
    {
        echo "&nbsp;Select ";
    }
    else
    {
        echo big52gb( "&nbsp;请选择" );
    }
    echo $typem[$type - 1]."<select name=\"boss\" class=za_select onChange=\"self.group.submit()\" style=\"background:ffff99;\">";
    $i = 0;
    while ( $i < $gcount )
    {
        if ( $boss == $gname[$i] )
        {
            $s = " selected";
        }
        else
        {
            $s = "";
        }
        echo "<option value=\"".$gname[$i]."\"".$s.">".$gstr[$i]."</option>";
        ++$i;
    }
    echo "</select>&nbsp;--";
}
echo "        <input type=BUTTON name=\"append\" class=za_button value=\"";
if ( $Lang == "iso-8859-2" )
{
    echo "Add new";
}
else
{
    echo big52gb( "新增" );
}
echo "\" onClick=\"SS_Edit('',0);\">\r\n";
echo $notfound;
echo "        <input type=\"hidden\" name=\"k_name\">\r\n        <input type=\"hidden\" name=\"k_mode\" value=\"0\">\r\n\t\t<input type=\"hidden\" name=\"k_f\" value=\"\">\r\n\t\t<input type=\"hidden\" name=\"k_ud\" value=\"0\">\r\n      </td>\r\n    </tr>\r\n    <TR> \r\n      <TD height=1 class=\"ag_index_ctrl_line\"></TD>\r\n    </TR>\r\n\t<TR> \r\n      <TD height=5></TD>\r\n    </TR>\r\n  </form>\r\n</table>\r\n  \r\n<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpaddi";
echo "ng=\"0\" class=\"ag_index_tab\">\r\n  <tr class=\"ag_index_title\"> \r\n    <td nowrap>";
echo $typem[$type];
if ( $Lang == "iso-8859-2" )
{
    echo " Acc No.";
}
else
{
    echo big52gb( " 帐号" );
}
echo "</td>\r\n    <td nowrap>";
if ( $Lang == "iso-8859-2" )
{
    echo "Name";
}
else
{
    echo big52gb( "名称" );
}
echo "</td>\r\n\t<td nowrap>";
if ( $Lang == "iso-8859-2" )
{
    echo "State";
}
else
{
    echo big52gb( "状况" );
}
echo "</td> \r\n\t<td nowrap>";
if ( $Lang == "iso-8859-2" )
{
    echo "Options";
}
else
{
    echo big52gb( "功\能" );
}
if ( $type == 1 && $MyData['Level'] <= 0 && $ReadOnly == FALSE )
{
    echo "&nbsp;[<a href=\"javascript:SS_Accs('');\"><font color=#ffff00>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Settle All Acc";
    }
    else
    {
        echo big52gb( "全部结算" );
    }
    echo "</font></a>]";
}
if ( $type <= 5 )
{
    echo "&nbsp;[<a href=\"javascript:SS_Found();\"><font color=#ffff00>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Search";
    }
    else
    {
        echo big52gb( "寻找" );
    }
    echo "</font></a>]";
}
echo "</td>\r\n";
if ( $type <= 4 && substr( $CFG['Check'], 5, 1 ) == "0" && substr( $CFG['Check'], 7, 1 ) != "9" )
{
    echo "    <td nowrap>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Currency";
    }
    else
    {
        echo big52gb( "币别" );
    }
    echo "</td>\r\n";
}
if ( substr( $CFG['Check'], 20, 1 ) != "1" || $type <= 4 )
{
    echo "    <td nowrap>";
    if ( $type <= 4 || substr( $CFG['Check'], 5, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "Credit";
        }
        else
        {
            echo big52gb( "信用额度" );
        }
    }
    else if ( $Lang == "iso-8859-2" )
    {
        echo "Balance";
    }
    else
    {
        echo big52gb( "开分点数" );
    }
    echo "</td>\r\n";
}
echo "    <td nowrap>";
if ( $type <= 4 )
{
    if ( $Lang == "iso-8859-2" )
    {
        echo "Used Credit";
    }
    else
    {
        echo big52gb( "已用额度" );
    }
}
else if ( substr( $CFG['Check'], 5, 1 ) == "1" )
{
    if ( $Lang == "iso-8859-2" )
    {
        echo "Balance";
    }
    else
    {
        echo big52gb( "开分点数" );
    }
}
else if ( $Lang == "iso-8859-2" )
{
    echo "Cur Credit";
}
else
{
    echo big52gb( "目前点数" );
}
echo "</td>\r\n\r\n";
if ( substr( $CFG['Check'], 20, 1 ) != "1" || $type <= 4 )
{
    echo "\t<td nowrap>";
    if ( $type < 4 )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "Biggest share %";
        }
        else
        {
            echo big52gb( "最大占成" );
        }
    }
    else if ( $type < 5 )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "Agent share %";
        }
        else
        {
            echo big52gb( "代理商占成" );
        }
    }
    else if ( $Lang == "iso-8859-2" )
    {
        echo "Tot Win";
    }
    else
    {
        echo big52gb( "总赢分" );
    }
    echo "</td>\r\n";
}
if ( 5 <= $type && 0 < $CFG['Rebate'] )
{
    echo "<td nowrap>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Rebate";
    }
    else
    {
        echo big52gb( "死码" );
    }
    echo "</td>";
}
if ( 4 <= $type )
{
    echo "<td nowrap>";
    if ( $type < 5 )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "Main Agent Comm";
        }
        else
        {
            echo big52gb( "总代理占成" );
        }
    }
    else
    {
        echo big52gb( $betstr );
    }
    echo "</td>";
}
if ( 5 <= $type && substr( $CFG['Check'], 5, 1 ) == "0" )
{
    echo "<td nowrap>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Total Win (Turn over)";
    }
    else
    {
        echo big52gb( "胜点" );
    }
    echo "</td>";
}
if ( substr( $CFG['Check'], 4, 1 ) == "1" )
{
    if ( $type <= 4 )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>Bac Rolling</td>";
        }
        else
        {
            echo "<td nowrap>百家乐</td>";
        }
    }
    else if ( $Lang == "iso-8859-2" )
    {
        echo "<td nowrap>Rolling</td>";
    }
    else
    {
        echo "<td nowrap>百家乐</td>";
    }
}
if ( $type != 6 )
{
    if ( substr( $CFG['Check'], 8, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>ChuHan Rolling</td>";
        }
        else
        {
            echo "<td nowrap>楚汉</td>";
        }
    }
    if ( substr( $CFG['Check'], 15, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>Roulette Rolling</td>";
        }
        else
        {
            echo "<td nowrap>轮盘</td>";
        }
    }
    if ( substr( $CFG['Check'], 16, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>Up9 Rolling</td>";
        }
        else
        {
            echo "<td nowrap>九仔升</td>";
        }
    }
    if ( substr( $CFG['Check'], 17, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>3Card Rolling</td>";
        }
        else
        {
            echo "<td nowrap>三公</td>";
        }
    }
    if ( substr( $CFG['Check'], 26, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>Sicbo Rolling</td>";
        }
        else
        {
            echo "<td nowrap>骰宝</td>";
        }
    }
    if ( substr( $CFG['Check'], 28, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>D-3 Rolling</td>";
        }
        else
        {
            echo "<td nowrap>18豆3</td>";
        }
    }
    if ( substr( $CFG['Check'], 29, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>D-4 Rolling</td>";
        }
        else
        {
            echo "<td nowrap>18豆4</td>";
        }
    }
    if ( substr( $CFG['Check'], 34, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>Domino TienGow</td>";
        }
        else
        {
            echo "<td nowrap>骨牌天九</td>";
        }
    }
    if ( substr( $CFG['Check'], 35, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>TienGow</td>";
        }
        else
        {
            echo "<td nowrap>天九</td>";
        }
    }
    if ( substr( $CFG['Check'], 36, 1 ) == "1" )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo "<td nowrap>PushTong</td>";
        }
        else
        {
            echo "<td nowrap>推筒子</td>";
        }
    }
}
if ( 5 <= $type && substr( $CFG['Check'], 20, 1 ) == "1" )
{
    echo "<td nowrap>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Rolling";
    }
    else
    {
        echo big52gb( "退水额" );
    }
    echo "</td>";
}
if ( substr( $CFG['Check'], 5, 1 ) == "0" && ( $type < 5 || substr( $CFG['Check'], 20, 1 ) != "1" ) )
{
    echo "<td nowrap>";
    if ( $type < 5 )
    {
        if ( $Lang == "iso-8859-2" )
        {
            echo $typem[$type + 1];
        }
        else
        {
            echo $typem[$type + 1].big52gb( "数" );
        }
    }
    else if ( $Lang == "iso-8859-2" )
    {
        echo "Recent Bets";
    }
    else
    {
        echo big52gb( "最近下注" );
    }
    echo "</td>";
}
if ( 5 <= $type && substr( $CFG['Check'], 20, 1 ) == "1" && substr( $MyData['Fun'], 11, 1 ) == "Y" )
{
    echo "    <td nowrap>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "In";
    }
    else
    {
        echo big52gb( "总开" );
    }
    echo "</td>\r\n\t<td nowrap>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Out";
    }
    else
    {
        echo big52gb( "总洗" );
    }
    echo "</td>\r\n\t<td nowrap>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Total";
    }
    else
    {
        echo big52gb( "盈余" );
    }
    echo "</td>\t\r\n\t";
}
else
{
    echo "    <td nowrap>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "IP";
    }
    else
    {
        echo big52gb( "IP位址" );
    }
    echo "</td>\r\n    ";
}
echo "    <td nowrap>";
if ( $Lang == "iso-8859-2" )
{
    echo "Date Added";
}
else
{
    echo big52gb( "新增日期" );
}
echo "</td>\r\n\t";
if ( $type != 5 )
{
    echo "<td nowrap>";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Last Login";
    }
    else
    {
        echo big52gb( "最近登入" );
    }
    echo "</td>";
}
echo "\t<td nowrap>";
if ( $Lang == "iso-8859-2" )
{
    echo "Login";
}
else
{
    echo big52gb( "登入" );
}
echo "</td>       \r\n  </tr>\r\n";
$k_unit = 0 - 1;
$start_no = $page * $CFG_Row;
if ( $rown <= $start_no && 1 <= $page )
{
    $start_no = ( $page - 1 ) * $CFG_Row;
}
$end_no = $start_no + $CFG_Row;
if ( $rown < $end_no )
{
    $end_no = $rown;
}
$i = $start_no;
while ( $i < $end_no )
{
    @mysql_data_seek( @$result, @$i );
    $row = mysql_fetch_row( $result );
    $roll = sprintf( "%d", $row[11] / 10 );
    if ( $roll <= 0 )
    {
        $roll = 0;
    }
    if ( $row[5] & 1 )
    {
        if ( $Lang == "iso-8859-2" )
        {
            $en = "<SPAN STYLE=\"background-color: rgb(255,0,0);\">&nbsp;<font color=yellow>STOP</font>&nbsp;</SPAN>";
        }
        else
        {
            $en = big52gb( "<SPAN STYLE=\"background-color: rgb(255,0,0);\">&nbsp;<font color=yellow>停用</font>&nbsp;</SPAN>" );
        }
    }
    else
    {
        if ( $Lang == "iso-8859-2" )
        {
            $en = "<font color=006600>In Use</font>";
        }
        else
        {
            $en = big52gb( "<font color=006600>启用</font>" );
        }
        if ( $type == 5 && $row[5] & 2 )
        {
            if ( $Lang == "iso-8859-2" )
            {
                $en = "<font color=ff0000>Locked</font>";
            }
            else
            {
                $en = big52gb( "<font color=ff0000>锁定</font>" );
            }
        }
    }
    if ( 0 < $row[4] )
    {
        $datec = date( m, $row[4] )."-".date( d, $row[4] )." ".date( H, $row[4] ).":".date( i, $row[4] );
    }
    else
    {
        $datec = "&nbsp;";
    }
    if ( 600 < $row[3] )
    {
        $datel = date( m, $row[3] - 600 )."-".date( d, $row[3] - 600 )." ".date( H, $row[3] - 600 ).":".date( i, $row[3] - 600 );
    }
    else
    {
        $datel = "&nbsp;";
    }
    if ( $type <= 4 )
    {
        if ( $row[7] == 0 - 1 )
        {
            if ( $Lang == "iso-8859-2" )
            {
                $rang = "No share %";
            }
            else
            {
                $rang = big52gb( "不占成" );
            }
        }
        else
        {
            $rang = "<font color=880000>".$row[7]."</font>%";
        }
        if ( $row[11] == 0 - 1 )
        {
            if ( $Lang == "iso-8859-2" )
            {
                $rang1 = "No share %";
            }
            else
            {
                $rang1 = big52gb( "不占成" );
            }
        }
        else
        {
            $rang1 = "<font color=880000>".$row[11]."</font>%";
        }
        if ( $row[12] == 0 - 1 )
        {
            if ( $Lang == "iso-8859-2" )
            {
                $rang2 = "No share %";
            }
            else
            {
                $rang2 = big52gb( "不占成" );
            }
        }
        else
        {
            $rang2 = "<font color=880000>".$row[12]."</font>%";
        }
    }
    else
    {
        if ( substr( $CFG['Check'], 5, 1 ) == "1" )
        {
            $winsum = $row[16];
        }
        else
        {
            $winsum = $row[9] - $row[2];
        }
        $rang = cfg_number( $winsum, 0, 0, FALSE );
        if ( $winsum < 0 )
        {
            $rang = "<a href='javascript:SS_tick(\"{$row['1']}\")'><font color=red>".$rang."</font><a>";
        }
        else
        {
            $rang = "<a href='javascript:SS_tick(\"{$row['1']}\")'><font color=green>".$rang."</font><a>";
        }
        $rang1 = cfg_number( $row[12], 0, 0, FALSE );
        $rang2 = cfg_number( $row[13], 0, 0, FALSE );
        if ( 0 < $row[8] )
        {
            $dateb = date( m, $row[8] )."-".date( d, $row[8] )." ".date( H, $row[8] ).":".date( i, $row[8] );
        }
        else
        {
            $dateb = "&nbsp;";
        }
    }
    if ( $type <= 1 )
    {
        $k_unit = $row[18];
    }
    if ( 2 <= $type && $type <= 4 && $k_unit == 0 - 1 )
    {
        $result2 = mysql_query( "SELECT gGid FROM b_group WHERE gSno='{$row['18']}' LIMIT 1", $comm );
        if ( 1 <= mysql_num_rows( $result2 ) )
        {
            $row2 = mysql_fetch_row( $result2 );
            $k_unit = $row2[0];
        }
    }
    echo "<tr class=\"ag_index_cen\" ";
    if ( $row[1] != $k_f )
    {
        echo "onmouseover=\"this.style.backgroundColor='#ddffdd';\" onmouseout=\"this.style.backgroundColor='#ffffff';\"";
    }
    else
    {
        echo "style=\"background: ff8888\"";
    }
    echo "> \r\n <td nowrap>";
    if ( $type != 5 )
    {
        echo "<a href=\"javascript:SS_Go('{$row['1']}');\">{$row['1']}</a>";
    }
    else if ( substr( $CFG['Check'], 5, 1 ) == "1" )
    {
        echo substr( $row[1], 0, 5 )."<font color=red><b>".substr( $row[1], 5, 3 )."</b></font>";
    }
    else if ( $row[5] & 8192 && ( ( $MyData['State'] & 16 ) == 0 || $MyData['Agent'] & 64 ) )
    {
        echo "<font color=ff00ff>{$row['1']}</font>";
    }
    else
    {
        echo $row[1];
    }
    echo "</td>\r\n <td nowrap><font color=000000>";
    echo $row[0];
    echo "</font></td>\r\n <td align=\"center\" nowrap>";
    echo $en;
    echo "</td>\r\n <td align=\"center\" nowrap>\r\n";
    if ( $ReadOnly == FALSE )
    {
        if ( $row[5] & 1 )
        {
            if ( $Lang == "iso-8859-2" )
            {
                $s = "Use";
            }
            else
            {
                $s = big52gb( "启用" );
            }
            if ( substr( $MyData['Fun'], 3, 1 ) == "Y" )
            {
                echo "<a href=\"javascript:SS_Check(2,'{$row['1']}')\">{$s}</a>";
            }
        }
        else
        {
            if ( $Lang == "iso-8859-2" )
            {
                $s = "Stop";
            }
            else
            {
                $s = big52gb( "停用" );
            }
            echo "<a href=\"javascript:SS_Check(1,'{$row['1']}')\">{$s}</a>";
        }
        $a = $row[5] & 1;
        if ( $type == 5 && $a == 0 )
        {
            if ( $row[5] & 2 )
            {
                if ( $Lang == "iso-8859-2" )
                {
                    echo " <a href='javascript:SS_lock(\"{$row['1']}\",\"UnLock\");'><font color=009900>Unlock</font></a>";
                }
                else
                {
                    echo big52gb( " <a href='javascript:SS_lock(\"{$row['1']}\",\"UnLock\");'><font color=009900>解除</font></a>" );
                }
            }
            else if ( $Lang == "iso-8859-2" )
            {
                echo " <a href='javascript:SS_lock(\"{$row['1']}\",\"Lock\");'><font color=blue>Lock</font></a>";
            }
            else
            {
                echo big52gb( " <a href='javascript:SS_lock(\"{$row['1']}\",\"Lock\");'><font color=blue>锁定</font></a>" );
            }
        }
    }
    if ( $type == 5 && ( $bSub == FALSE || $bSub == TRUE && $MyData['Agent'] & 16384 ) )
    {
        if ( substr( $MyData['Fun'], 5, 1 ) == "Y" )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <a href=\"javascript:SS_Score('{$row['1']}','UP',0);\"><font color=ff00ff>[+]</font></a>";
            }
            else
            {
                echo big52gb( " <a href=\"javascript:SS_Score('{$row['1']}','UP',0);\"><font color=ff00ff>上分</font></a>" );
            }
        }
        if ( substr( $MyData['Fun'], 6, 1 ) == "Y" && $ReadOnly == FALSE )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <a href=\"javascript:SS_Score('{$row['1']}','DOWN',".sprintf( "%d", $row[9] ).");\"><font color=ff00ff>[-]</font></a>";
            }
            else
            {
                echo big52gb( " <a href=\"javascript:SS_Score('{$row['1']}','DOWN',".sprintf( "%d", $row[9] ).");\"><font color=ff00ff>洗分</font></a>" );
            }
        }
    }
    if ( $ReadOnly == FALSE )
    {
        if ( substr( $MyData['Fun'], 10, 1 ) == "Y" && substr( $CFG['Check'], 20, 1 ) == "1" )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <a href=\"javascript:SS_Roll('{$row['1']}','{$row['11']}');\"><font color=ff00ff>Roll</font></a>";
            }
            else
            {
                echo big52gb( " <a href=\"javascript:SS_Roll('{$row['1']}','{$roll}');\"><font color=ff00ff>退水</font></a>" );
            }
        }
        if ( substr( $MyData['Fun'], 7, 1 ) == "Y" && $AdjAccs == TRUE )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <a href=\"javascript:SS_Accs('{$row['1']}');\"><font color=ff00ff>Settle</font></a>";
            }
            else
            {
                echo big52gb( " <a href=\"javascript:SS_Accs('{$row['1']}');\"><font color=ff00ff>结算</font></a>" );
            }
        }
        if ( $ReadOnly == FALSE && ( substr( $MyData['Fun'], 9, 1 ) == "Y" || $type != 5 ) )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <a href=\"javascript:SS_Edit('{$row['1']}',0);\">Edit</a>";
            }
            else
            {
                echo big52gb( " <a href=\"javascript:SS_Edit('{$row['1']}',0);\">修改</a>" );
            }
        }
        else if ( substr( $MyData['Fun'], 4, 1 ) == "Y" )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <font color=blue style='cursor:hand' onclick='alert(\"{$row['20']}\")'>Pwd</font>";
            }
            else
            {
                echo big52gb( " <font color=blue style='cursor:hand' onclick='alert(\"{$row['20']}\")'>密码</font>" );
            }
        }
        if ( substr( $MyData['Fun'], 2, 1 ) == "Y" && ( substr( $MyData['Fun'], 9, 1 ) == "Y" || $type != 5 ) )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <a href=\"javascript:SS_Check('3','{$row['1']}')\">Delete</a>";
            }
            else
            {
                echo big52gb( " <a href=\"javascript:SS_Check('3','{$row['1']}')\">删除</a>" );
            }
        }
        if ( $MyData['Level'] <= 4 && substr( $CFG['Check'], 20, 1 ) == "1" && $type == 5 )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <font color=blue style='cursor:hand' onClick=\"javascript:SS_Chip('{$row['1']}','{$row['20']}')\">Create Card</font>";
            }
            else
            {
                echo big52gb( " <font color=blue style='cursor:hand' onClick=\"javascript:SS_Chip('{$row['1']}','{$row['20']}')\">发卡</font>" );
            }
        }
    }
    if ( $ReadOnly == TRUE )
    {
        if ( $bSub == FALSE && substr( $MyData['Fun'], 4, 1 ) == "Y" || $bSub == TRUE && $MyData['Agent'] & 2048 )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <font color=blue style='cursor:hand' onclick='alert(\"{$row['20']}\")'>Pwd</font>";
            }
            else
            {
                echo big52gb( " <font color=blue style='cursor:hand' onclick='alert(\"{$row['20']}\")'>密码</font>" );
            }
        }
        if ( $bSub == TRUE && $MyData['Agent'] & 4096 && ( substr( $MyData['Fun'], 9, 1 ) == "Y" || $type != 5 ) )
        {
            if ( $Lang == "iso-8859-2" )
            {
                echo " <<font color=blue style='cursor:hand' onclick=\"javascript:SS_ChgPwd('{$row['1']}');\">Edit</font>";
            }
            else
            {
                echo big52gb( " <font color=blue style='cursor:hand' onclick=\"javascript:SS_ChgPwd('{$row['1']}');\">改密码</font>" );
            }
        }
    }
    echo " </td>\r\n\r\n ";
    if ( $type <= 4 && $CFG['CurrC'][0] != "" )
    {
        echo "<td nowrap align=center><font color=000000>";
        if ( $Lang == "iso-8859-2" )
        {
            echo $CFG['CurrE'][$k_unit];
        }
        else
        {
            echo big52gb( $CFG['CurrC'][$k_unit] );
        }
        echo "</font></td>";
    }
    echo " ";
    if ( substr( $CFG['Check'], 20, 1 ) != "1" || $type <= 4 )
    {
        echo " <td align=\"right\" nowrap>";
        if ( $Lang != "iso-8859-2" )
        {
            echo "<font color=990000>".cfg_number( $row[2] / 10000, 0, 0, FALSE )."</font>".big52gb( "万" );
        }
        else
        {
            echo "<font color=990000>".cfg_number( $row[2] / 1000, 0, 0, FALSE )."</font>T";
        }
        echo "</td>\r\n ";
    }
    echo " <td align=\"right\" nowrap>\r\n  ";
    if ( $type <= 4 )
    {
        $ary = gettreecredit( $row[1], 0 - 1 );
        if ( $type == 4 )
        {
            $ary[1] = $ary[2];
        }
        $dateb = $ary[0];
        if ( $Lang != "iso-8859-2" )
        {
            echo "<font color=990000>".cfg_number( $ary[1] / 10000, 0, 0, FALSE )."</font>".big52gb( "万" );
        }
        else
        {
            echo "<font color=990000>".cfg_number( $ary[1] / 1000, 0, 0, FALSE )."</font>T";
        }
    }
    else
    {
        echo "<font color=990000>".cfg_number( $row[9], substr( $CFG['Check'], 7, 1 ), 0, FALSE )."</font>";
    }
    echo " </td>\r\n";
    if ( substr( $CFG['Check'], 20, 1 ) != "1" || $type <= 4 )
    {
        echo " <td align=\"";
        if ( $type == 5 )
        {
            echo "right";
        }
        else
        {
            echo "center";
        }
        echo "\" nowrap>";
        echo big52gb( $rang );
        echo "</td>\r\n";
    }
    if ( 5 <= $type && 0 < $CFG['Rebate'] )
    {
        echo "<td nowrap align=right>";
        if ( substr( $MyData['Fun'], 5, 1 ) == "Y" && ( $bSub == FALSE || $bSub == TRUE && $MyData['Agent'] & 16384 ) )
        {
            echo "<a href=\"javascript:SS_Score('{$row['1']}','UPD',0);\"><font color=660000>".cfg_number( $row[14], 0, 0, 0 )."</font></a>";
        }
        else
        {
            echo cfg_number( $row[14], 0, 0, 0 );
        }
        echo "</td>";
    }
    if ( 4 <= $type )
    {
        echo "<td align=\"";
        if ( $type == 5 )
        {
            echo "right";
        }
        else
        {
            echo "center";
        }
        echo "\" nowrap>";
        echo big52gb( $rang1 );
        echo "</td>";
    }
    if ( 5 <= $type && substr( $CFG['Check'], 5, 1 ) == "0" )
    {
        echo "<td align=\"";
        if ( $type == 5 )
        {
            echo "right";
        }
        else
        {
            echo "center";
        }
        echo "\" nowrap>";
        echo big52gb( $rang2 );
        echo "</td>\r\n";
    }
    if ( substr( $CFG['Check'], 4, 1 ) == "1" )
    {
        $s = explode( ",", $row[15] );
        echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
        if ( $type == 1 )
        {
            if ( $row[5] & 8 )
            {
                if ( $Lang == "iso-8859-2" )
                {
                    echo "Total Win (Turn over)";
                }
                else
                {
                    echo big52gb( "胜点" );
                }
            }
            else
            {
                echo big52gb( "{$betstr}" );
            }
        }
        echo "</td>";
    }
    if ( $type != 6 )
    {
        if ( substr( $CFG['Check'], 8, 1 ) == "1" )
        {
            $s = explode( ",", $row[17] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 2048 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Win (Turn over)";
                    }
                    else
                    {
                        echo big52gb( "胜点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
        if ( substr( $CFG['Check'], 15, 1 ) == "1" )
        {
            $s = explode( ",", $row[19] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 1024 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Loss";
                    }
                    else
                    {
                        echo big52gb( "输点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
        if ( substr( $CFG['Check'], 16, 1 ) == "1" )
        {
            $s = explode( ",", $row[21] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 16384 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Loss";
                    }
                    else
                    {
                        echo big52gb( "胜点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
        if ( substr( $CFG['Check'], 17, 1 ) == "1" )
        {
            $s = explode( ",", $row[22] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 32768 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Loss";
                    }
                    else
                    {
                        echo big52gb( "胜点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
        if ( substr( $CFG['Check'], 26, 1 ) == "1" )
        {
            $s = explode( ",", $row[25] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 262144 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Loss";
                    }
                    else
                    {
                        echo big52gb( "胜点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
        if ( substr( $CFG['Check'], 28, 1 ) == "1" )
        {
            $s = explode( ",", $row[26] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 1048576 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Loss";
                    }
                    else
                    {
                        echo big52gb( "胜点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
        if ( substr( $CFG['Check'], 29, 1 ) == "1" )
        {
            $s = explode( ",", $row[27] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 4194304 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Loss";
                    }
                    else
                    {
                        echo big52gb( "胜点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
        if ( substr( $CFG['Check'], 34, 1 ) == "1" )
        {
            $s = explode( ",", $row[28] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 16777216 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Loss";
                    }
                    else
                    {
                        echo big52gb( "胜点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
        if ( substr( $CFG['Check'], 35, 1 ) == "1" )
        {
            $s = explode( ",", $row[29] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 67108864 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Loss";
                    }
                    else
                    {
                        echo big52gb( "胜点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
        if ( substr( $CFG['Check'], 36, 1 ) == "1" )
        {
            $s = explode( ",", $row[30] );
            echo "<td align=center nowrap><font color=006600>".sprintf( "%.1f", $s[0] )."</font>%";
            if ( $type == 1 )
            {
                if ( $row[5] & 268435456 )
                {
                    if ( $Lang == "iso-8859-2" )
                    {
                        echo "Total Loss";
                    }
                    else
                    {
                        echo big52gb( "胜点" );
                    }
                }
                else
                {
                    echo big52gb( "{$betstr}" );
                }
            }
            echo "</td>";
        }
    }
    if ( 5 <= $type && substr( $CFG['Check'], 20, 1 ) == "1" )
    {
        echo "<td align=right>";
        echo cfg_number( $roll, 0, 0, FALSE );
        echo "</td>";
    }
    if ( substr( $CFG['Check'], 5, 1 ) == "0" && ( $type < 5 || substr( $CFG['Check'], 20, 1 ) != "1" ) )
    {
        echo "<td align=\"center\" nowrap>";
        echo $dateb;
        echo "</td>";
    }
    if ( 5 <= $type && substr( $CFG['Check'], 20, 1 ) == "1" && substr( $MyData['Fun'], 11, 1 ) == "Y" )
    {
        echo " <td nowrap align=right>";
        echo cfg_number( $row[23], 0, 0, 0 );
        echo "</td>\r\n <td nowrap align=right>";
        echo cfg_number( $row[24], 0, 0, 0 );
        echo "</td>\r\n <td nowrap align=right><a href='javascript:SS_ResetCoin(\"";
        echo $row[1];
        echo "\")'>";
        echo cfg_number( $row[23] - $row[24], 0, 1, 0 );
        echo "</a></td> \r\n";
    }
    else
    {
        echo " <td nowrap>";
        echo $row[6];
        echo "</td>\r\n";
    }
    echo " <td align=\"center\" nowrap>";
    echo $datec;
    echo "</td>\r\n";
    if ( $type != 5 )
    {
        echo " <td align=\"center\" nowrap>";
        echo $datel;
        echo "</td>";
    }
    echo " <td align=\"right\" nowrap>";
    echo $row[10];
    echo "</td>  \r\n  </tr>\r\n  ";
    ++$i;
}
echo "</table>\r\n";
if ( $type == 5 )
{
    echo "<table><tr><td><img src=\"images/blue.gif\" width=\"14\" height=\"14\" align=\"absmiddle\">[<font color=\"#990000\">";
    if ( $Lang == "iso-8859-2" )
    {
        echo "Lock";
    }
    else
    {
        echo big52gb( "锁定" );
    }
    echo "</font>] ";
    if ( $Lang == "iso-8859-2" )
    {
        echo "This means that the user can still enter the game, but cannot bet.";
    }
    else
    {
        echo big52gb( "表示会员仍可进入游戏,但下注会失败。" );
    }
    echo "</td></tr></table>\r\n";
}
echo "</td></tr></table>\r\n</body>\r\n</html>";
?>
